You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sdk/identity/identity/README.md
+60-40Lines changed: 60 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,25 @@ to authenticate API requests. It supports token authentication using an Azure Ac
6
6
7
7
## Getting started
8
8
9
+
### Install the package
10
+
11
+
Install Azure Identity with `npm`:
12
+
13
+
```sh
14
+
npm install --save @azure/identity
15
+
```
16
+
9
17
### Prerequisites
10
18
11
19
- Node.js 8 LTS or higher
12
20
- An Azure subscription.
13
-
- You can sign up for a [free account](https://azure.microsoft.com/free/).
21
+
- You can sign up for a [free account](https://azure.microsoft.com/free/).
14
22
- The [Azure CLI][azure_cli] can also be useful for authenticating in a development environment, creating accounts, and managing account roles.
15
23
24
+
### Authenticate the client
25
+
26
+
When debugging and executing code locally it is typical for a developer to use their own account for authenticating calls to Azure services. There are several developer tools which can be used to perform this authentication in your development environment.
27
+
16
28
#### Authenticating via Visual Studio Code
17
29
18
30
Developers using Visual Studio Code can use the [Azure Account Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account), to authenticate via the IDE. Applications using the `DefaultAzureCredential` or the `VisualStudioCodeCredential` can then use this account to authenticate calls in their application when running locally.
@@ -33,14 +45,6 @@ For systems without a default web browser, the `az login` command will use the d
If this is your first time using `@azure/identity` or the Microsoft identity platform (Azure Active Directory), we recommend that you read [Using `@azure/identity` with Microsoft Identity Platform](https://github.com/Azure/azure-sdk-for-js/blob/master/documentation/using-azure-identity.md) first. This document will give you a deeper understanding of the platform and how to configure your Azure account correctly.
@@ -64,18 +68,35 @@ The `DefaultAzureCredential` is appropriate for most scenarios where the applica
64
68
- Visual Studio Code - If the developer has authenticated via the Visual Studio Code Azure Account plugin, the `DefaultAzureCredential` will authenticate with that account.
65
69
- Azure CLI - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
66
70
67
-
### Environment variables
71
+
## Environment Variables
72
+
73
+
`DefaultAzureCredential` and `EnvironmentCredential` can be configured with environment variables. Each type of authentication requires values for specific variables:
68
74
69
-
`DefaultAzureCredential` and `EnvironmentCredential` are configured for service principal authentication with these environment variables:
|`AZURE_CLIENT_ID`| id of an Azure Active Directory application |
96
+
|`AZURE_USERNAME`| a username (usually an email address) |
97
+
|`AZURE_PASSWORD`| that user's password |
98
+
99
+
Configuration is attempted in the above order. For example, if values for a client secret and certificate are both present, the client secret will be used.
79
100
80
101
## Examples
81
102
@@ -131,36 +152,35 @@ const client = new KeyClient(vaultUrl, credentialChain);
131
152
132
153
### Authenticating Azure Hosted Applications
133
154
134
-
|credential | usage
135
-
|-|-
136
-
|`DefaultAzureCredential`|provides a simplified authentication experience to quickly start developing applications run in the Azure cloud
137
-
|`ChainedTokenCredential`|allows users to define custom authentication flows composing multiple credentials
138
-
|`EnvironmentCredential`|authenticates a service principal or user via credential information specified in environment variables
139
-
|`ManagedIdentityCredential`|authenticates the managed identity of an azure resource
0 commit comments