@azure/identity 1.2.0-beta.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @azure/identity might be problematic. Click here for more details.

Files changed (72) hide show
  1. package/CHANGELOG.md +24 -2
  2. package/README.md +75 -55
  3. package/dist/index.js +533 -396
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/client/msalClient.js +138 -0
  6. package/dist-esm/src/client/msalClient.js.map +1 -0
  7. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js +2 -2
  8. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
  9. package/dist-esm/src/credentials/authorizationCodeCredential.js +3 -1
  10. package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
  11. package/dist-esm/src/credentials/azureCliCredential.browser.js +2 -2
  12. package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
  13. package/dist-esm/src/credentials/azureCliCredential.js +5 -5
  14. package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
  15. package/dist-esm/src/credentials/chainedTokenCredential.js +2 -2
  16. package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
  17. package/dist-esm/src/credentials/clientCertificateCredential.browser.js +2 -2
  18. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
  19. package/dist-esm/src/credentials/clientCertificateCredential.js +5 -3
  20. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  21. package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
  22. package/dist-esm/src/credentials/clientSecretCredential.js +2 -2
  23. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  24. package/dist-esm/src/credentials/deviceCodeCredential.browser.js +2 -2
  25. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
  26. package/dist-esm/src/credentials/deviceCodeCredential.js +53 -47
  27. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
  28. package/dist-esm/src/credentials/environmentCredential.browser.js +2 -2
  29. package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
  30. package/dist-esm/src/credentials/environmentCredential.js +6 -2
  31. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  32. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +7 -5
  33. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
  34. package/dist-esm/src/credentials/interactiveBrowserCredential.js +30 -69
  35. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
  36. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  37. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +44 -0
  38. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -0
  39. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +74 -0
  40. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -0
  41. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +41 -0
  42. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -0
  43. package/dist-esm/src/credentials/managedIdentityCredential/constants.js +8 -0
  44. package/dist-esm/src/credentials/managedIdentityCredential/constants.js.map +1 -0
  45. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +59 -0
  46. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -0
  47. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +109 -0
  48. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -0
  49. package/dist-esm/src/credentials/{managedIdentityCredential.browser.js → managedIdentityCredential/index.browser.js} +4 -4
  50. package/dist-esm/src/credentials/managedIdentityCredential/index.browser.js.map +1 -0
  51. package/dist-esm/src/credentials/managedIdentityCredential/index.js +165 -0
  52. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -0
  53. package/dist-esm/src/credentials/managedIdentityCredential/models.js +3 -0
  54. package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -0
  55. package/dist-esm/src/credentials/managedIdentityCredential/utils.js +28 -0
  56. package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -0
  57. package/dist-esm/src/credentials/usernamePasswordCredential.js +3 -1
  58. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  59. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +2 -2
  60. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
  61. package/dist-esm/src/credentials/visualStudioCodeCredential.js +19 -8
  62. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
  63. package/dist-esm/src/index.js.map +1 -1
  64. package/dist-esm/src/util/checkTenantId.js +11 -0
  65. package/dist-esm/src/util/checkTenantId.js.map +1 -0
  66. package/dist-esm/src/util/logging.js +7 -3
  67. package/dist-esm/src/util/logging.js.map +1 -1
  68. package/package.json +7 -5
  69. package/types/identity.d.ts +9 -33
  70. package/dist-esm/src/credentials/managedIdentityCredential.browser.js.map +0 -1
  71. package/dist-esm/src/credentials/managedIdentityCredential.js +0 -376
  72. package/dist-esm/src/credentials/managedIdentityCredential.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,8 +1,30 @@
1
1
  # Release History
2
2
 
3
+ ## 1.2.0 (2020-11-11)
4
+
5
+ ### Changes since 1.1.\*
6
+
7
+ - With 1.2, we've added support for Azure Arc to our Managed Identity credential.
8
+ - We've also added an Interactive Browser credential for Node, which spawns the user's browser and connects via
9
+ a browser-based auth code flow. This is powered by the Microsoft Authentication Library (MSAL)
10
+ - We've moved `DeviceCodeCredential` to also use the Microsoft Authentication Library (MSAL)
11
+ - Identity now supports Subject Name/Issuer (SNI) as part of authentication for ClientCertificateCredential.
12
+ - Added Active Directory Federation Services authority host support to the node credentials.
13
+ - `ManagedIdentityCredential` has been aligned with other languages, and now treats expected errors properly.
14
+ - Added support for multiple clouds on `VisualStudioCodeCredential`.
15
+
16
+ ### Changes since the latest 1.2-beta
17
+
18
+ - `ManagedIdentityCredential` now only checks for available MSIs once per class instance.
19
+ - `ManagedIdentityCredential` now supports Azure Arc environments.
20
+ - `ManagedIdentityCredential` now supports Azure Service Fabric environments.
21
+ - Added authority host for multiple clouds on `VisualStudioCodeCredential`, and specified `AzureCloud` as the default cloud name.
22
+ - `DeviceCodeCredential` now has both of its constructor parameters, `tenantId` and `clientId`, as optional parameters. The default value of `tenantId` is "organizations", and the Azure CLI's client ID is the default value of `clientId`.
23
+ - We've removed the persistent cache support from the previous beta.
24
+
3
25
  ## 1.2.0-beta.2 (2020-10-06)
4
26
 
5
- - `DefaultAzureCredential` now by default shows the Device Code message on the console. This can still be overwritten with a custom behavior by specifying a function as the third parameter, `userPromptCallback`.
27
+ - `DeviceCodeCredential` now by default shows the Device Code message on the console. This can still be overwritten with a custom behavior by specifying a function as the third parameter, `userPromptCallback`.
6
28
  - Added support for multiple clouds on `VisualStudioCodeCredential`. Fixes customer issue [11452](https://github.com/Azure/azure-sdk-for-js/issues/11452).
7
29
  - `ManagedIdentityCredential` has been aligned with other languages, now treating expected errors properly. This fixes customer issue [11451](https://github.com/Azure/azure-sdk-for-js/issues/11451).
8
30
  - `InteractiveBrowserCredential` authentication now uses the silent flow if the user provides a cache and authentication record for lookup.
@@ -18,7 +40,7 @@
18
40
 
19
41
  ## 1.1.0 (2020-08-11)
20
42
 
21
- ### Changes since 1.0.*
43
+ ### Changes since 1.0.\*
22
44
 
23
45
  - With 1.1.0, new developer credentials are now available: `VisualStudioCodeCredential` and `AzureCliCredential`.
24
46
  - `VisualStudioCodeCredential` allows developers to log into Azure using the credentials available after logging in through the Azure Account extension in Visual Studio Code.
package/README.md CHANGED
@@ -6,20 +6,32 @@ 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.
19
31
 
20
32
  To authenticate in Visual Studio Code, first ensure the [Azure Account Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) is installed. Once the extension is installed, press `F1` to open the command palette and run the `Azure: Sign In` command.
21
33
 
22
- ![Visual Studio Code Account Sign In][VsCodeLoginCommand_image]
34
+ ![Visual Studio Code Account Sign In][vscodelogincommand_image]
23
35
 
24
36
  #### Authenticating via the Azure CLI
25
37
 
@@ -27,19 +39,11 @@ Applications using the `AzureCliCredential`, rather directly or via the `Default
27
39
 
28
40
  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.
29
41
 
30
- ![Azure CLI Account Sign In][AzureCliLogin_image]
42
+ ![Azure CLI Account Sign In][azureclilogin_image]
31
43
 
32
44
  For systems without a default web browser, the `az login` command will use the device code authentication flow. The user can also force the Azure CLI to use the device code flow rather than launching a browser by specifying the `--use-device-code` argument.
33
45
 
34
- ![Azure CLI Account Device Code Sign In][AzureCliLoginDeviceCode_image]
35
-
36
- ### Install the package
37
-
38
- Install Azure Identity with `npm`:
39
-
40
- ```sh
41
- npm install --save @azure/identity
42
- ```
46
+ ![Azure CLI Account Device Code Sign In][azureclilogindevicecode_image]
43
47
 
44
48
  ## Key concepts
45
49
 
@@ -57,25 +61,42 @@ See [Credential Classes](#credential-classes).
57
61
 
58
62
  The `DefaultAzureCredential` is appropriate for most scenarios where the application is intended to ultimately be run in the Azure Cloud. This is because the `DefaultAzureCredential` combines credentials commonly used to authenticate when deployed, with credentials used to authenticate in a development environment. The `DefaultAzureCredential` will attempt to authenticate via the following mechanisms in order.
59
63
 
60
- ![DefaultAzureCredential authentication flow][DefaultAuthFlow_image]
64
+ ![DefaultAzureCredential authentication flow][defaultauthflow_image]
61
65
 
62
- - Environment - The `DefaultAzureCredential` will read account information specified via [environment variables](#Environment-variables) and use it to authenticate.
66
+ - Environment - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
63
67
  - Managed Identity - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
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:
75
+ #### Service principal with secret
70
76
 
71
- | variable name | value |
72
- | ------------------------------- | ---------------------------------------------------------------------------------------------------- |
73
- | `AZURE_CLIENT_ID` | service principal's app id |
74
- | `AZURE_TENANT_ID` | id of the principal's Azure Active Directory tenant |
75
- | `AZURE_CLIENT_SECRET` | one of the service principal's client secrets (implies `ClientSecretCredential`) |
76
- | `AZURE_CLIENT_CERTIFICATE_PATH` | path to a PEM-encoded certificate file including private key (implies `ClientCertificateCredential`) |
77
- | `AZURE_USERNAME` | the username of a user in the tenant (implies `UsernamePasswordCredential`) |
78
- | `AZURE_PASSWORD` | the password of the user specified in `AZURE_USERNAME` |
77
+ | variable name | value |
78
+ | --------------------- | ----------------------------------------------------- |
79
+ | `AZURE_CLIENT_ID` | id of an Azure Active Directory application |
80
+ | `AZURE_TENANT_ID` | id of the application's Azure Active Directory tenant |
81
+ | `AZURE_CLIENT_SECRET` | one of the application's client secrets |
82
+
83
+ #### Service principal with certificate
84
+
85
+ | variable name | value |
86
+ | ------------------------------- | ------------------------------------------------------------------------------------------ |
87
+ | `AZURE_CLIENT_ID` | id of an Azure Active Directory application |
88
+ | `AZURE_TENANT_ID` | id of the application's Azure Active Directory tenant |
89
+ | `AZURE_CLIENT_CERTIFICATE_PATH` | path to a PEM-encoded certificate file including private key (without password protection) |
90
+
91
+ #### Username and password
92
+
93
+ | variable name | value |
94
+ | ----------------- | ------------------------------------------- |
95
+ | `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
155
+ | credential | usage |
156
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------- |
157
+ | `DefaultAzureCredential` | provides a simplified authentication experience to quickly start developing applications run in the Azure cloud |
158
+ | `ChainedTokenCredential` | allows users to define custom authentication flows composing multiple credentials |
159
+ | `EnvironmentCredential` | authenticates a service principal or user via credential information specified in environment variables |
160
+ | `ManagedIdentityCredential` | authenticates the managed identity of an azure resource |
140
161
 
141
162
  ### Authenticating Service Principals
142
163
 
143
- |credential | usage
144
- |-|-
145
- |`ClientSecretCredential`|authenticates a service principal using a secret
146
- |`ClientCertificateCredential`|authenticates a service principal using a certificate
164
+ | credential | usage |
165
+ | ----------------------------- | ----------------------------------------------------- |
166
+ | `ClientSecretCredential` | authenticates a service principal using a secret |
167
+ | `ClientCertificateCredential` | authenticates a service principal using a certificate |
147
168
 
148
169
  ### Authenticating Users
149
170
 
150
- |credential | usage
151
- |-|-
152
- |`InteractiveBrowserCredential`|interactively authenticates a user with the default system browser
153
- |`DeviceCodeCredential`|interactively authenticates a user on devices with limited UI
154
- |`UserPasswordCredential`|authenticates a user with a username and password
155
- |`AuthorizationCodeCredential`|authenticate a user with a previously obtained authorization code
171
+ | credential | usage |
172
+ | ------------------------------ | ------------------------------------------------------------------ |
173
+ | `InteractiveBrowserCredential` | interactively authenticates a user with the default system browser |
174
+ | `DeviceCodeCredential` | interactively authenticates a user on devices with limited UI |
175
+ | `UserPasswordCredential` | authenticates a user with a username and password |
176
+ | `AuthorizationCodeCredential` | authenticate a user with a previously obtained authorization code |
156
177
 
157
178
  ### Authenticating via Development Tools
158
179
 
159
-
160
- |credential | usage
161
- |-|-
162
- |`AzureCliCredential`|authenticate in a development environment with the Azure CLI
163
- |`VisualStudioCodeCredential`|authenticate in a development environment with Visual Studio Code
180
+ | credential | usage |
181
+ | ---------------------------- | ----------------------------------------------------------------- |
182
+ | `AzureCliCredential` | authenticate in a development environment with the Azure CLI |
183
+ | `VisualStudioCodeCredential` | authenticate in a development environment with Visual Studio Code |
164
184
 
165
185
  ## Troubleshooting
166
186
 
@@ -184,12 +204,12 @@ setLogLevel("info");
184
204
 
185
205
  Currently, the following client libraries support authenticating with `TokenCredential` and the Azure Identity library. You can learn more about their use, and find additional documentation on use of these client libraries along samples with can be found in the links below.
186
206
 
187
- - [@azure/event-hubs](http://npmjs.com/package/@azure/event-hubs)
188
- - [@azure/keyvault-keys](http://npmjs.com/package/@azure/keyvault-keys)
189
- - [@azure/keyvault-secrets](http://npmjs.com/package/@azure/keyvault-secrets)
190
- - [@azure/keyvault-certificates](http://npmjs.com/package/@azure/keyvault-certificates)
191
- - [@azure/storage-blob](http://npmjs.com/package/@azure/storage-blob)
192
- - [@azure/storage-queue](http://npmjs.com/package/@azure/storage-queue)
207
+ - [@azure/event-hubs](https://npmjs.com/package/@azure/event-hubs)
208
+ - [@azure/keyvault-keys](https://npmjs.com/package/@azure/keyvault-keys)
209
+ - [@azure/keyvault-secrets](https://npmjs.com/package/@azure/keyvault-secrets)
210
+ - [@azure/keyvault-certificates](https://npmjs.com/package/@azure/keyvault-certificates)
211
+ - [@azure/storage-blob](https://npmjs.com/package/@azure/storage-blob)
212
+ - [@azure/storage-queue](https://npmjs.com/package/@azure/storage-queue)
193
213
 
194
214
  ### Read the documentation
195
215
 
@@ -213,9 +233,9 @@ If you'd like to contribute to this library, please read the [contributing guide
213
233
  [8]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/interactivebrowsercredential.html
214
234
  [9]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/usernamepasswordcredential.html
215
235
  [azure_cli]: https://docs.microsoft.com/cli/azure
216
- [VsCodeLoginCommand_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/VsCodeLoginCommand.png
217
- [AzureCliLogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/AzureCliLogin.png
218
- [AzureCliLoginDeviceCode_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/AzureCliLoginDeviceCode.png
219
- [DefaultAuthFlow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/DefaultAzureCredentialAuthenticationFlow.png
236
+ [vscodelogincommand_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/VsCodeLoginCommand.png
237
+ [azureclilogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/AzureCliLogin.png
238
+ [azureclilogindevicecode_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/AzureCliLoginDeviceCode.png
239
+ [defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/DefaultAzureCredentialAuthenticationFlow.png
220
240
 
221
241
  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fidentity%2Fidentity%2FREADME.png)