Skip to content

Commit f6b26ec

Browse files
authored
Update identity api september 2021 (Azure#24512)
1 parent 0b0bd3c commit f6b26ec

28 files changed

+490
-156
lines changed

sdk/identity/azure-identity/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
## 1.4.0-beta.2 (Unreleased)
44

55
### Features Added
6+
- Added `tenantId` setter on `AzurePowerShellCredential` and `AzureCliCredential`
67

7-
### Breaking Changes
8+
### Breaking Changes from 1.4.0-beta.1
9+
Note the breaking changes below don't apply if you're upgrading from a previous released stable version.
10+
11+
- Removed 'AzureApplicationCredential' and 'AzureApplicationCredentialBuilder'
12+
- Removed 'regionalAuthority' setter on `ClientSecretCredentialBuilder` and `ClientCertificateCredentialBuilder`
13+
- Removed `RegionalAuthority` enum class.
14+
- Removed `allowMultiTenantAuthentication` method from Credential Builders. The Multi Tenant Authentication is enabled by default now.
815

916
### Bugs Fixed
1017

sdk/identity/azure-identity/README.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Azure Identity client library for Java
2-
The Azure Identity library provides [Azure Active Directory (AAD)](https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis) token authentication through a set of convenient [TokenCredential](https://docs.microsoft.com/java/api/com.azure.core.credential.tokencredential?view=azure-java-stable) implementations. It enables Azure SDK clients to authenticate with AAD, while also allowing other Java apps to authenticate with AAD work and school accounts, Microsoft personal accounts (MSA), and other Identity providers through the [AAD B2C](https://docs.microsoft.com/azure/active-directory-b2c/overview) service.
2+
The Azure Identity library provides [Azure Active Directory (AAD)](https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis) token authentication support across the Azure SDK. It provides a set of TokenCredential implementations which can be used to construct Azure SDK clients which support AAD token authentication.
33

44
[Source code][source] | [API reference documentation][javadoc] | [Azure Active Directory documentation][aad_doc]
55

@@ -61,10 +61,9 @@ Maven dependency for Azure Secret Client library. Add it to your project's pom f
6161

6262
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:
6363

64-
- [Azure Toolkit for IntelliJ](https://github.com/Azure/azure-sdk-for-java/wiki/Set-up-Your-Environment-for-Authentication#sign-in-azure-toolkit-for-intellij-for-intellijcredential)
65-
- [Visual Studio Code Azure Account Extension](https://github.com/Azure/azure-sdk-for-java/wiki/Set-up-Your-Environment-for-Authentication#sign-in-visual-studio-code-azure-account-extension-for-visualstudiocodecredential)
66-
- [Azure CLI](https://github.com/Azure/azure-sdk-for-java/wiki/Set-up-Your-Environment-for-Authentication#sign-in-azure-cli-for-azureclicredential)
67-
- [Visual Studio 2019 (Shared token cache)](https://github.com/Azure/azure-sdk-for-java/wiki/Set-up-Your-Environment-for-Authentication#enable-applications-for-shared-token-cache-credential)
64+
- [Azure Toolkit for IntelliJ](https://docs.microsoft.com/azure/developer/java/sdk/identity-dev-env-auth#intellij-credential)
65+
- [Visual Studio Code Azure Account Extension](https://docs.microsoft.com/azure/developer/java/sdk/identity-dev-env-auth#visual-studio-code-credential)
66+
- [Azure CLI](https://docs.microsoft.com/azure/developer/java/sdk/identity-dev-env-auth#azure-cli-credential)
6867

6968
Click on each item above to learn about how to configure them for Azure Identity authentication.
7069

@@ -118,7 +117,9 @@ public void createDefaultAzureCredential() {
118117
See more how to configure the `DefaultAzureCredential` on your workstation or Azure in [Configure DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-java/wiki/Set-up-Your-Environment-for-Authentication#configure-defaultazurecredential).
119118

120119
### Authenticating a user assigned managed identity with `DefaultAzureCredential`
121-
This example demonstrates authenticating the `SecretClient` from the [azure-security-keyvault-secrets][secrets_client_library] client library using the `DefaultAzureCredential`, deployed to an Azure resource with a user assigned managed identity configured.
120+
To Authenticate using User Assigned Managed Identity, please ensure that configuration instructions for your supported Azure Resource [here](#managed-identity-support) have been successfully completed.
121+
122+
The below example demonstrates authenticating the `SecretClient` from the [azure-security-keyvault-secrets][secrets_client_library] client library using the `DefaultAzureCredential`, deployed to an Azure resource with a user assigned managed identity configured.
122123

123124
See more about how to configure a user assigned managed identity for an Azure resource in [Enable managed identity for Azure resources](https://github.com/Azure/azure-sdk-for-java/wiki/Set-up-Your-Environment-for-Authentication#enable-managed-identity-for-azure-resources).
124125

@@ -143,7 +144,9 @@ public void createDefaultAzureCredentialForUserAssignedManagedIdentity() {
143144
In addition to configuring the `managedIdentityClientId` via code, it can also be set using the `AZURE_CLIENT_ID` environment variable. These two approaches are equivalent when using the `DefaultAzureCredential`.
144145

145146
### Authenticating a user in Azure Toolkit for IntelliJ with `DefaultAzureCredential`
146-
This example demonstrates authenticating the `SecretClient` from the [azure-security-keyvault-secrets][secrets_client_library] client library using the `DefaultAzureCredential`, on a workstation with IntelliJ IDEA installed, and the user has signed in with an Azure account to the Azure Toolkit for IntelliJ.
147+
To Authenticate using IntelliJ, please ensure that configuration instructions [here](https://docs.microsoft.com/azure/developer/java/sdk/identity-dev-env-auth#sign-in-azure-toolkit-for-intellij-for-intellijcredential) have been successfully completed.
148+
149+
The below example demonstrates authenticating the `SecretClient` from the [azure-security-keyvault-secrets][secrets_client_library] client library using the `DefaultAzureCredential`, on a workstation with IntelliJ IDEA installed, and the user has signed in with an Azure account to the Azure Toolkit for IntelliJ.
147150

148151
See more about how to configure your IntelliJ IDEA in [Sign in Azure Toolkit for IntelliJ for IntelliJCredential](https://github.com/Azure/azure-sdk-for-java/wiki/Set-up-Your-Environment-for-Authentication#sign-in-azure-toolkit-for-intellij-for-intellijcredential).
149152

@@ -169,6 +172,7 @@ public void createDefaultAzureCredentialForIntelliJ() {
169172
## Managed Identity Support
170173
The [Managed identity authentication](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview) is supported via either the `DefaultAzureCredential` or the `ManagedIdentityCredential` directly for the following Azure Services:
171174
* [Azure Virtual Machines](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token)
175+
* [Azure Virtual Machines Scale Sets](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/qs-configure-powershell-windows-vmss)
172176
* [Azure App Service](https://docs.microsoft.com/azure/app-service/overview-managed-identity?tabs=dotnet)
173177
* [Azure Kubernetes Service](https://docs.microsoft.com/azure/aks/use-managed-identity)
174178
* [Azure Cloud Shell](https://docs.microsoft.com/azure/cloud-shell/msi-authorization)
@@ -214,6 +218,22 @@ public void createManagedIdentityCredential() {
214218
}
215219
```
216220

221+
## Cloud Configuration
222+
Credentials default to authenticating to the Azure Active Directory endpoint for
223+
Azure Public Cloud. To access resources in other clouds, such as Azure Government
224+
or a private cloud, configure credentials with the `auhtorityHost` argument.
225+
[AzureAuthorityHosts](https://docs.microsoft.com/java/api/com.azure.identity.azureauthorityhosts?view=azure-java-stable)
226+
defines authorities for well-known clouds:
227+
```java
228+
DefaultAzureCredential defaultAzureCredential = new DefaultAzureCredentialBuilder()
229+
.authorityHost(AzureAuthorityHosts.AZURE_GOVERNMENT)
230+
.build();
231+
```
232+
Not all credentials require this configuration. Credentials which authenticate
233+
through a development tool, such as `AzureCliCredential`, use that tool's
234+
configuration. Similarly, `VisualStudioCodeCredential` accepts an `authority`
235+
argument but defaults to the authority matching VS Code's "Azure: Cloud" setting.
236+
217237
## Credential classes
218238

219239
### Authenticating Azure Hosted Applications
@@ -455,6 +475,7 @@ describes why authentication failed. When this exception is raised by `ChainedTo
455475
When credentials cannot execute authentication due to one of the underlying resources required by the credential being unavailable on the machine, the`CredentialUnavailableException` is raised and it has a `message` attribute which
456476
describes why the credential is unavailable for authentication execution . When this exception is raised by `ChainedTokenCredential`, the message collects error messages from each credential in the chain.
457477

478+
See the [troubleshooting guide](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity/TROUBLESHOOT.md) for details on how to diagnose various failure scenarios.
458479
### Enable client logging
459480

460481
Azure SDK for Java offers a consistent logging story to help aid in troubleshooting application errors and expedite

0 commit comments

Comments
 (0)