diff --git a/sdk/management/README.md b/sdk/management/README.md index 4f90efd07bfb5..35b6908b3087f 100644 --- a/sdk/management/README.md +++ b/sdk/management/README.md @@ -80,13 +80,14 @@ With above configuration, `azure` client can be authenticated by following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); TokenCredential credential = new DefaultAzureCredentialBuilder() - .authorityHost(profile.environment().getActiveDirectoryEndpoint()) .build(); Azure azure = Azure .authenticate(credential, profile) .withDefaultSubscription(); ``` +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + See [Authentication][authenticate] for more options. ### Code snippets and samples diff --git a/sdk/management/docs/AUTH.md b/sdk/management/docs/AUTH.md index 6207ef90c2ba7..27662a7c918d0 100644 --- a/sdk/management/docs/AUTH.md +++ b/sdk/management/docs/AUTH.md @@ -59,6 +59,17 @@ Sample code to create a `AzureProfile`: AzureProfile profile = new AzureProfile("", "", AzureEnvironment.AZURE); ``` +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +Sample code for Azure Germany, with `EnvironmentCredential`: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE_GERMANY); +EnvironmentCredential credential = new EnvironmentCredentialBuilder() + .authorityHost(profile.environment().getActiveDirectoryEndpoint()) + .build(); +``` + ### Authenticating with default HttpPipeline Once the `TokenCredential` and `AzureProfile` are ready, you can move forward with below authenticating code. It helps build http pipeline internally with [default configuration](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resources/mgmt/src/main/java/com/azure/resourcemanager/resources/fluentcore/utils/HttpPipelineProvider.java#L43).