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

Mgmt: update Azure in docs #15416

Merged
merged 2 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions sdk/resourcemanager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
TokenCredential credential = new DefaultAzureCredentialBuilder()
.authorityHost(profile.environment().getActiveDirectoryEndpoint())
.build();
Azure azure = Azure
AzureResourceManager azure = AzureResourceManager
.authenticate(credential, profile)
.withDefaultSubscription();
```
Expand Down Expand Up @@ -253,7 +253,7 @@ azure.virtualMachines().listByResourceGroupAsync(rgName)
You can customize various aspects of the client.

```java
Azure azure = Azure
AzureResourceManager azure = AzureResourceManager
.configure()
.withHttpClient(customizedHttpClient)
.withPolicy(additionalPolicy)
Expand Down Expand Up @@ -301,7 +301,7 @@ locate the root issue. View the [logging][logging] wiki for guidance about enabl

Sample code to enable logging in Azure Management Libraries.
```java
Azure azure = Azure
AzureResourceManager azure = AzureResourceManager
.configure()
.withLogLevel(HttpLogDetailLevel.BASIC)
.authenticate(credential, profile)
Expand Down
10 changes: 5 additions & 5 deletions sdk/resourcemanager/docs/AUTH.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ EnvironmentCredential credential = new EnvironmentCredentialBuilder()
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/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/utils/HttpPipelineProvider.java#L43).

```java
Azure azure = Azure.authenticate(credential, profile).withDefaultSubscription();
AzureResourceManager azure = AzureResourceManager.authenticate(credential, profile).withDefaultSubscription();
```

The `Authenticated` class provides access to a subset of Azure APIs that do not require a specific subscription. If the profile does not contain a subscription, you can select a subscription via [`Authenticated::subscriptions`](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/azure-resourcemanager/src/main/java/com/azure/resourcemanager/AzureResourceManager.java#L200). Similarly, you can select a tenant via [`Authenticated::tenants`](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/azure-resourcemanager/src/main/java/com/azure/resourcemanager/AzureResourceManager.java#L207).

```java
Azure.Authenticated authenticated = Azure.authenticate(credential, profile);
AzureResourceManager.Authenticated authenticated = AzureResourceManager.authenticate(credential, profile);
String subscriptionId = authenticated.subscriptions().list().iterator().next().subscriptionId();
Azure azure = authenticated.withSubscription(subscriptionId);
AzureResourceManager azure = authenticated.withSubscription(subscriptionId);
```

## Advanced Authentication
Expand Down Expand Up @@ -117,13 +117,13 @@ HttpPipeline httpPipeline = new HttpPipelineBuilder()
Once your custom configurations are ready, you can move forward with below authenticating code. It would execute the settings you apply in the custom HttpPipeline.

```java
Azure azure = Azure.authenticate(httpPipeline, profile).withDefaultSubscription();
AzureResourceManager azure = AzureResourceManager.authenticate(httpPipeline, profile).withDefaultSubscription();
```

If you want to configure part of http pipeline instead of building new one, you may set via `Azure::configure`.

```java
Azure azure = Azure.configure()
AzureResourceManager azure = AzureResourceManager.configure()
.withPolicy(customPolicy)
.withRetryPolicy(customRetryPolicy)
.withHttpClient(httpClient)
Expand Down
10 changes: 5 additions & 5 deletions sdk/resourcemanager/docs/MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ In addition to this change, the **support for using auth file has been removed**
**In old version (`com.microsoft.azure.management.**`)**

```java
Azure azure = Azure.authenticate(new File("my.azureauth")).withDefaultSubscription();
AzureResourceManager azure = AzureResourceManager.authenticate(new File("my.azureauth")).withDefaultSubscription();
```
**In new version, this feature has been removed.** If this creates concern on your side, please file an issue to let us know.

Expand All @@ -85,7 +85,7 @@ So:
**In old version (`com.microsoft.azure.management.**`)**

```java
Azure azure = Azure.configure()
AzureResourceManager azure = AzureResourceManager.configure()
.withInterceptor(new CustomizedInterceptor())
.authenticate(credential)
.withDefaultSubscription();
Expand All @@ -94,7 +94,7 @@ Azure azure = Azure.configure()
**Equivalent in new version (`com.azure.resourcemanager.**`)**

```java
Azure azure = Azure.configure()
AzureResourceManager azure = AzureResourceManager.configure()
.withPolicy(new CustomizedPolicy())
.authenticate(credential, profile)
.withDefaultSubscription();
Expand All @@ -112,7 +112,7 @@ RestClient client = new RestClient.Builder(builder, new Retrofit.Builder())
.withCredentials(credential)
.build();

Azure azure = Azure.authenticate(client, "<TenantId>")
AzureResourceManager azure = AzureResourceManager.authenticate(client, "<TenantId>")
.withDefaultSubscription();
```

Expand All @@ -123,7 +123,7 @@ HttpClient client = new OkHttpAsyncHttpClientBuilder()
.proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("127.0.0.1", 8888)))
.build();

Azure azure = Azure.configure()
AzureResourceManager azure = AzureResourceManager.configure()
.withHttpClient(client)
.authenticate(credential, profile)
.withDefaultSubscription();
Expand Down
2 changes: 1 addition & 1 deletion sdk/resourcemanager/docs/SAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
TokenCredential credential = new DefaultAzureCredentialBuilder()
.authorityHost(profile.environment().getActiveDirectoryEndpoint())
.build();
Azure azure = Azure
AzureResourceManager azure = AzureResourceManager
.authenticate(credential, profile)
.withDefaultSubscription();
```
Expand Down
2 changes: 1 addition & 1 deletion sdk/resourcemanager/docs/THROTTLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ By default, `RetryPolicy` is added to the HTTP pipeline. It will automatically r
HTTP policy `ResourceManagerThrottlingPolicy` can be added to HTTP pipeline, to provide real-time information on remaining requests, before throttling kick-in.

```java
Azure azure = Azure.configure()
AzureResourceManager azure = AzureResourceManager.configure()
.withPolicy(new ResourceManagerThrottlingPolicy((response, throttlingInfo) -> {
// throttlingInfo.getRateLimit()
}))
Expand Down