From 7bb49b53dc27267a59e189f5e3b601fa99799dcf Mon Sep 17 00:00:00 2001 From: "Erich(Renyong) Wang" Date: Mon, 25 May 2020 15:55:46 +0800 Subject: [PATCH 1/4] update change log for KeyVault track 2 mgmt sdk --- .../Azure.Management.KeyVault/CHANGELOG.md | 74 ++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md b/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md index b183b6bdac5c9..fc47908ac36c5 100644 --- a/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md +++ b/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md @@ -2,5 +2,75 @@ ## 1.0.0-preview.1 -### New Features -- Initial preview of Azure Management KeyVault SDK based on Azure.Core \ No newline at end of file +This is public preview version based on Azure Core. This version uses a next-generation code generator that introduces important new features. + +### General New Features + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing + - Support uniform telemetry across all languages + +### Migration from Previous Version of Azure Management SDK + +#### Package Name +The package name has been changed from `Microsoft.Azure.Management.KeyVault` to `Azure.Management.KeyVault` + +#### Create Key Vault + +Before +```csharp +using Microsoft.Azure.Management.KeyVault; +using Microsoft.Azure.Management.KeyVault.Models; + +var keyVaultManagementClient = new KeyVaultManagementClient(credentials); +var vault = await keyVaultManagementClient.Vaults.BeginCreateOrUpdateAsync + ( + resourceGroupName, + vaultName, + parameters + ); +``` + +After +```csharp +using Azure.Identity; +using Azure.Management.KeyVault; +using Azure.Management.KeyVault.Models; + +var keyVaultManagementClient = new KeyVaultManagementClient(SubscriptionId, + new DefaultAzureCredential(), + new KeyVaultManagementClientOptions()); +var vaultsClient = keyVaultManagementClient.GetVaultsClient(); + +var vault = await vaultsClient.StartCreateOrUpdateAsync( + resourceGroupName, + vaultName, + parameters + ); +var vaultValue = (await vault.WaitForCompletionAsync()).Value; + +``` + +#### Create Model Permissions + +Before +```csharp +var permissions = new Permissions + { + Keys = new string[] { "all" }, + Secrets = new string[] { "all" }, + Certificates = new string[] { "all" }, + Storage = new string[] { "all" }, + } +``` + +After +```csharp +var permissions = new Permissions + { + Keys = new KeyPermissions[] { new KeyPermissions("all") }, + Secrets = new SecretPermissions[] { new SecretPermissions("all") }, + Certificates = new CertificatePermissions[] { new CertificatePermissions("all") }, + Storage = new StoragePermissions[] { new StoragePermissions("all") }, + }; +``` From 48759872c0002f05c80708f5c75b78a3beee1ad8 Mon Sep 17 00:00:00 2001 From: "Erich(Renyong) Wang" Date: Tue, 26 May 2020 12:43:07 +0800 Subject: [PATCH 2/4] update change log --- .../Azure.Management.KeyVault/CHANGELOG.md | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md b/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md index fc47908ac36c5..d0b3edef3585e 100644 --- a/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md +++ b/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md @@ -2,27 +2,37 @@ ## 1.0.0-preview.1 -This is public preview version based on Azure Core. This version uses a next-generation code generator that introduces important new features. +This package follows the new Azure SDK guidelines which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. + +This is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, please submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). ### General New Features - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing + - HTTP pipeline with custom policies + - Better Error-handling - Support uniform telemetry across all languages +> NOTE: For more information about unified authentication, please refer to [Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet) + ### Migration from Previous Version of Azure Management SDK #### Package Name The package name has been changed from `Microsoft.Azure.Management.KeyVault` to `Azure.Management.KeyVault` -#### Create Key Vault +#### Management Client Changes -Before +Example: Create a Key Vault Instace: + +Before upgrade: ```csharp using Microsoft.Azure.Management.KeyVault; using Microsoft.Azure.Management.KeyVault.Models; +using Microsoft.Rest; -var keyVaultManagementClient = new KeyVaultManagementClient(credentials); +var tokenCredentials = new TokenCredentials("YOUR ACCESS TOKEN"); +var keyVaultManagementClient = new KeyVaultManagementClient(tokenCredentials); var vault = await keyVaultManagementClient.Vaults.BeginCreateOrUpdateAsync ( resourceGroupName, @@ -31,7 +41,7 @@ var vault = await keyVaultManagementClient.Vaults.BeginCreateOrUpdateAsync ); ``` -After +After upgrade: ```csharp using Azure.Identity; using Azure.Management.KeyVault; @@ -51,9 +61,11 @@ var vaultValue = (await vault.WaitForCompletionAsync()).Value; ``` -#### Create Model Permissions +#### Object Model Changes + +Example: Create a Permissions Model -Before +Before upgrade: ```csharp var permissions = new Permissions { @@ -64,7 +76,7 @@ var permissions = new Permissions } ``` -After +After upgrade: ```csharp var permissions = new Permissions { From bb7c703187554e0288e34fb6fcd5673e351af00c Mon Sep 17 00:00:00 2001 From: "Erich(Renyong) Wang" Date: Tue, 26 May 2020 12:55:00 +0800 Subject: [PATCH 3/4] refine change log --- sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md b/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md index d0b3edef3585e..662b587f6b745 100644 --- a/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md +++ b/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md @@ -11,7 +11,7 @@ This is a Public Preview version, so expect incompatible changes in subsequent r - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing - HTTP pipeline with custom policies - - Better Error-handling + - Better error-handling - Support uniform telemetry across all languages > NOTE: For more information about unified authentication, please refer to [Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet) @@ -23,7 +23,7 @@ The package name has been changed from `Microsoft.Azure.Management.KeyVault` to #### Management Client Changes -Example: Create a Key Vault Instace: +Example: Create a Key Vault Instance: Before upgrade: ```csharp From 58b4bb45b92909ba3a9d78501c9924755ae3a68f Mon Sep 17 00:00:00 2001 From: "Erich(Renyong) Wang" Date: Thu, 28 May 2020 18:01:38 +0800 Subject: [PATCH 4/4] refine code sample --- sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md b/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md index 662b587f6b745..4be119f159e76 100644 --- a/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md +++ b/sdk/keyvault/Azure.Management.KeyVault/CHANGELOG.md @@ -47,7 +47,8 @@ using Azure.Identity; using Azure.Management.KeyVault; using Azure.Management.KeyVault.Models; -var keyVaultManagementClient = new KeyVaultManagementClient(SubscriptionId, +var keyVaultManagementClient = new KeyVaultManagementClient( + SubscriptionId, new DefaultAzureCredential(), new KeyVaultManagementClientOptions()); var vaultsClient = keyVaultManagementClient.GetVaultsClient(); @@ -80,9 +81,9 @@ After upgrade: ```csharp var permissions = new Permissions { - Keys = new KeyPermissions[] { new KeyPermissions("all") }, - Secrets = new SecretPermissions[] { new SecretPermissions("all") }, - Certificates = new CertificatePermissions[] { new CertificatePermissions("all") }, - Storage = new StoragePermissions[] { new StoragePermissions("all") }, + Keys = new [] { new KeyPermissions("all") }, + Secrets = new [] { new SecretPermissions("all") }, + Certificates = new [] { new CertificatePermissions("all") }, + Storage = new [] { new StoragePermissions("all") }, }; ```