Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@azure/identity readme azure -> Azure #12838

Merged
2 commits merged into from
Jan 26, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions sdk/identity/identity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ To authenticate in Visual Studio Code, first ensure the [Azure Account Extension

Applications using the `AzureCliCredential`, rather directly or via the `DefaultAzureCredential`, can use the Azure CLI account to authenticate calls in the application when running locally.

To authenticate with the [Azure CLI][azure_cli] users can run the command `az login`. For users running on a system with a default web browser the azure cli will launch the browser to authenticate the user.
To authenticate with the [Azure CLI][azure_cli] users can run the command `az login`. For users running on a system with a default web browser the Azure cli will launch the browser to authenticate the user.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Thank you for making this pull request. I appreciate the effort you're putting here! I like these casing on the Azure name, very necessary! Thanks!


![Azure CLI Account Sign In][azureclilogin_image]

Expand Down Expand Up @@ -107,24 +107,32 @@ This example demonstrates authenticating the `KeyClient` from the [@azure/keyvau
```javascript
// The default credential first checks environment variables for configuration as described above.
// If environment configuration is incomplete, it will try managed identity.

// Azure Key Vault service to use
const { KeyClient } = require("@azure/keyvault-keys");

// Azure authentication library to access Azure Key Vault
const { DefaultAzureCredential } = require("@azure/identity");

// Azure SDK clients accept the credential as a parameter
const credential = new DefaultAzureCredential();

// Create authenticated client
const client = new KeyClient(vaultUrl, credential);

// Use service from authenticated client
const getResult = await client.getKey("MyKeyName");
```

### Specifying a user assigned managed identity with the `DefaultAzureCredential`

Many Azure hosts allow the assignment of a user assigned managed identity. This example demonstrates configuring the `DefaultAzureCredential` to authenticate a user assigned identity when deployed to an azure host. It then authenticates a `KeyClient` from the [@azure/keyvault-keys](https://www.npmjs.com/package/@azure/keyvault-keys) client library with credential.
Many Azure hosts allow the assignment of a user assigned managed identity. This example demonstrates configuring the `DefaultAzureCredential` to authenticate a user assigned identity when deployed to an Azure host. It then authenticates a `KeyClient` from the [@azure/keyvault-keys](https://www.npmjs.com/package/@azure/keyvault-keys) client library with credential.

```ts
const { KeyClient } = require("@azure/keyvault-keys");
const { DefaultAzureCredential } = require("@azure/identity");

// when deployed to an azure host the default azure credential will authenticate the specified user assigned managed identity
// when deployed to an Azure host the default Azure credential will authenticate the specified user assigned managed identity
var credential = new DefaultAzureCredential({ managedIdentityClientId: userAssignedClientId });

const client = new KeyClient(vaultUrl, credential);
Expand Down Expand Up @@ -157,7 +165,7 @@ const client = new KeyClient(vaultUrl, credentialChain);
| `DefaultAzureCredential` | provides a simplified authentication experience to quickly start developing applications run in the Azure cloud |
| `ChainedTokenCredential` | allows users to define custom authentication flows composing multiple credentials |
| `EnvironmentCredential` | authenticates a service principal or user via credential information specified in environment variables |
| `ManagedIdentityCredential` | authenticates the managed identity of an azure resource |
| `ManagedIdentityCredential` | authenticates the managed identity of an Azure resource |

### Authenticating Service Principals

Expand Down Expand Up @@ -211,6 +219,8 @@ Currently, the following client libraries support authenticating with `TokenCred
- [@azure/storage-blob](https://npmjs.com/package/@azure/storage-blob)
- [@azure/storage-queue](https://npmjs.com/package/@azure/storage-queue)

If you need to authenticate to a different service, use the [@azure/ms-rest-js](https://www.npmjs.com/package/@azure/ms-rest-js) client library.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ms-rest-js is not used for auth, the alternatives would be to use ms-rest-nodeauth for node applications and ms-rest-browserauth for browser applications.

The list above is not complete. We have about 10 more packages that now work with Azure Identity.

Moreover, with the code generator updated as described in Azure/autorest.typescript#815, the Azure Identity library will be usable with all auto generated packages. So, I believe this clarification would not be needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We agreed to undo change to line 222 and remove package list right above it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done in #13113


### Read the documentation

API documentation for this library can be found on our [documentation site](https://docs.microsoft.com/javascript/api/@azure/identity).
Expand Down