From b936f3cd730de8abec28fe53f81a5bc11decdec8 Mon Sep 17 00:00:00 2001 From: "Erich(Renyong) Wang" Date: Mon, 1 Jun 2020 17:44:19 +0800 Subject: [PATCH 1/2] update change logs for track 2 mgmt sdks --- .../CHANGELOG.md | 35 ++- .../Azure.Management.Compute/CHANGELOG.md | 277 +++++++++++++++++- .../Azure.Management.EventHub/CHANGELOG.md | 134 ++++++++- .../Azure.Management.Network/CHANGELOG.md | 109 ++++++- .../Azure.Management.Resources/CHANGELOG.md | 152 +++++++++- .../Azure.Management.Storage/CHANGELOG.md | 90 +++++- 6 files changed, 785 insertions(+), 12 deletions(-) diff --git a/sdk/appconfiguration/Azure.Management.AppConfiguration/CHANGELOG.md b/sdk/appconfiguration/Azure.Management.AppConfiguration/CHANGELOG.md index 0c771dd35ce73..bea0d3fd181c0 100644 --- a/sdk/appconfiguration/Azure.Management.AppConfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/Azure.Management.AppConfiguration/CHANGELOG.md @@ -2,5 +2,36 @@ ## 1.0.0-preview.1 -### New Features -- Initial preview of Azure Management SDK based on Azure.Core \ No newline at end of file +This package follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) 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 + - 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) + +### Samples + +The package name is `Azure.Management.AppConfiguration` + +Example: Create an configuration store + +```csharp +using Azure.Identity; +using Azure.Management.AppConfiguration; +using Azure.Management.AppConfiguration.Models; + +var appConfigurationManagementClient = new AppConfigurationManagementClient(subscriptionId, new DefaultAzureCredential()); +var configurationStoresClient = eventHubsManagementClient.GetConfigurationStoresClient(); + +var configurationCreateResult = await configurationStoresClient.StartCreateAsync( + resourceGroup, + storeName, + new ConfigurationStore("westus", new Sku("Standard"))); +await configurationCreateResult.WaitForCompletionAsync(); +``` diff --git a/sdk/compute/Azure.Management.Compute/CHANGELOG.md b/sdk/compute/Azure.Management.Compute/CHANGELOG.md index 0c771dd35ce73..7d715c8489026 100644 --- a/sdk/compute/Azure.Management.Compute/CHANGELOG.md +++ b/sdk/compute/Azure.Management.Compute/CHANGELOG.md @@ -2,5 +2,278 @@ ## 1.0.0-preview.1 -### New Features -- Initial preview of Azure Management SDK based on Azure.Core \ No newline at end of file +This package follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) 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.Compute` to `Azure.Management.Compute` + +#### Management Client Changes + +Example: Create a VM: + +Before upgrade: +```csharp +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Azure.Management.Compute; +using Microsoft.Azure.Management.Compute.Models; +using Microsoft.Azure.Management.Network; +using Microsoft.Azure.Management.Network.Models; +using Microsoft.Azure.Management.ResourceManager; +using Microsoft.Azure.Management.ResourceManager.Fluent; +using Microsoft.Azure.Management.ResourceManager.Models; +using IPVersion = Microsoft.Azure.Management.Network.Models.IPVersion; +using ResourceManagementClient = Microsoft.Azure.Management.ResourceManager.ResourceManagementClient; +using Sku = Microsoft.Azure.Management.Compute.Models.Sku; +using SubResource = Microsoft.Azure.Management.Compute.Models.SubResource; + +var credentials = new TokenCredentials("YOUR ACCESS TOKEN");; + +var resourceClient = new ResourceManagementClient(credentials); +var networkClient = new NetworkManagementClient(credentials); +var computeClient = new ComputeManagementClient(credentials); + +resourceClient.SubscriptionId = subscriptionId; +networkClient.SubscriptionId = subscriptionId; +computeClient.SubscriptionId = subscriptionId; + +// Create Resource Group +await resourceClient.ResourceGroups.CreateOrUpdateAsync(resourceGroup, new ResourceGroup(location)); + +// Create Availability Set +var availabilitySet = new AvailabilitySet(location) +{ + PlatformUpdateDomainCount = 5, + PlatformFaultDomainCount = 2, + Sku = new Sku("Aligned"), +}; + +availabilitySet = await computeClient.AvailabilitySets + .CreateOrUpdateAsync(resourceGroup, vmName + "_aSet", availabilitySet); + +// Create IP Address +var ipAddress = new PublicIPAddress() +{ + PublicIPAddressVersion = IPVersion.IPv4, + PublicIPAllocationMethod = IPAllocationMethod.Dynamic, + Location = location, +}; + +ipAddress = await networkClient + .PublicIPAddresses.BeginCreateOrUpdateAsync(resourceGroup, vmName + "_ip", ipAddress); + +// Create VNet +var vnet = new VirtualNetwork() +{ + Location = location, + AddressSpace = new AddressSpace() { AddressPrefixes = new List() { "10.0.0.0/16" } }, + Subnets = new List() + { + new Subnet() + { + Name = "mySubnet", + AddressPrefix = "10.0.0.0/24", + } + }, +}; + +vnet = await networkClient.VirtualNetworks + .BeginCreateOrUpdateAsync(resourceGroup, vmName + "_vent", vnet); + +// Create Network interface +var nic = new NetworkInterface() +{ + Location = location, + IpConfigurations = new List() + { + new NetworkInterfaceIPConfiguration() + { + Name = "Primary", + Primary = true, + Subnet = new Subnet() { Id = vnet.Subnets.First().Id }, + PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, + PublicIPAddress = new PublicIPAddress() { Id = ipAddress.Id } + } + } +}; + +nic = await networkClient.NetworkInterfaces + .BeginCreateOrUpdateAsync(resourceGroup, vmName + "_nic", nic); + +var vm = new VirtualMachine(location) +{ + NetworkProfile = new NetworkProfile { NetworkInterfaces = new[] { new NetworkInterfaceReference() { Id = nic.Id } } }, + AvailabilitySet = new SubResource { Id = availabilitySet.Id }, + OsProfile = new OSProfile + { + ComputerName = "testVM", + AdminUsername = "azureUser", + AdminPassword = "azure12345QWE!", + LinuxConfiguration = new LinuxConfiguration { DisablePasswordAuthentication = false, ProvisionVMAgent = true } + }, + StorageProfile = new StorageProfile() + { + ImageReference = new ImageReference() + { + Offer = "UbuntuServer", + Publisher = "Canonical", + Sku = "18.04-LTS", + Version = "latest" + }, + DataDisks = new List() + }, + HardwareProfile = new HardwareProfile() { VmSize = VirtualMachineSizeTypes.StandardB1ms }, +}; + +await computeClient.VirtualMachines.BeginCreateOrUpdateAsync(resourceGroup, vmName, vm); + +``` + +After upgrade: +```csharp +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +using Azure.Identity; +using Azure.Management.Compute.Models; +using Azure.Management.Network; +using Azure.Management.Network.Models; + + +var computeClient = new ComputeManagementClient(subscriptionId, new DefaultAzureCredential()); +var networkClient = new NetworkManagementClient(subscriptionId, new DefaultAzureCredential()); + +var availabilitySetsClient = computeClient.GetAvailabilitySetsClient(); +var virtualNetworksClient = networkClient.GetVirtualNetworksClient(); +var networkInterfaceClient = networkClient.GetNetworkInterfacesClient(); +var virtualMachinesClient = computeClient.GetVirtualMachinesClient(); +// Create AvailabilitySet +var availabilitySet = new AvailabilitySet(location) +{ + PlatformUpdateDomainCount = 5, + PlatformFaultDomainCount = 2, + Sku = new Sku() { Name = "Aligned" } // TODO. Verify new codegen on AvailabilitySetSkuTypes.Aligned +}; + +availabilitySet = await availabilitySetsClient.CreateOrUpdateAsync(resourceGroup, vmName + "_aSet", availabilitySet); + +// Create VNet +var vnet = new VirtualNetwork() +{ + Location = location, + AddressSpace = new AddressSpace() { AddressPrefixes = new List() { "10.0.0.0/16" } }, + Subnets = new List() + { + new Subnet() + { + Name = "mySubnet", + AddressPrefix = "10.0.0.0/24", + } + }, +}; + +vnet = await virtualNetworksClient + .StartCreateOrUpdate(resourceGroup, vmName + "_vent", vnet) + .WaitForCompletionAsync(); + +// Create Network interface +var nic = new NetworkInterface() +{ + Location = location, + IpConfigurations = new List() + { + new NetworkInterfaceIPConfiguration() + { + Name = "Primary", + Primary = true, + Subnet = new Subnet() { Id = vnet.Subnets.First().Id }, + PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, + } + } +}; + +nic = await networkInterfaceClient + .StartCreateOrUpdate(resourceGroup, vmName + "_nic", nic) + .WaitForCompletionAsync(); + +var vm = new VirtualMachine(location) +{ + NetworkProfile = new Compute.Models.NetworkProfile { NetworkInterfaces = new[] { new NetworkInterfaceReference() { Id = nic.Id } } }, + OsProfile = new OSProfile + { + ComputerName = "testVM", + AdminUsername = "username", + AdminPassword = "(YourPassword)", + LinuxConfiguration = new LinuxConfiguration { DisablePasswordAuthentication = false, ProvisionVMAgent = true } + }, + StorageProfile = new StorageProfile() + { + ImageReference = new ImageReference() + { + Offer = "UbuntuServer", + Publisher = "Canonical", + Sku = "18.04-LTS", + Version = "latest" + }, + DataDisks = new List() + }, + HardwareProfile = new HardwareProfile() { VmSize = VirtualMachineSizeTypes.StandardB1Ms }, +}; +vm.AvailabilitySet.Id = availabilitySet.Id; + +var operaiontion = await virtualMachinesClient.StartCreateOrUpdateAsync(resourceGroup, vmName, vm); +await operaiontion.WaitForCompletionAsync(); + +``` + +#### Object Model Changes + +Example: Create a Virtual Machine Extension + +Before upgrade: +```csharp +var vmExtension = new VirtualMachineExtension + { + Location = ComputeManagementTestUtilities.DefaultLocation, + Tags = new Dictionary() { { "extensionTag1", "1" }, { "extensionTag2", "2" } }, + Publisher = "Microsoft.Compute", + VirtualMachineExtensionType = "VMAccessAgent", + TypeHandlerVersion = "2.0", + AutoUpgradeMinorVersion = true, + ForceUpdateTag = "RerunExtension", + Settings = "{}", + ProtectedSettings = "{}" + }; + typeof(Resource).GetRuntimeProperty("Name").SetValue(vmExtension, "vmext01"); + typeof(Resource).GetRuntimeProperty("Type").SetValue(vmExtension, "Microsoft.Compute/virtualMachines/extensions"); +``` + +After upgrade: +```csharp +var vmExtension = new VirtualMachineExtension( + null, + "vmext01", + "Microsoft.Compute/virtualMachines/extensions", + "SoutheastAsia", + new Dictionary() { { "extensionTag1", "1" }, { "extensionTag2", "2" } }, + "RerunExtension", + "Microsoft.Compute", + "VMAccessAgent", "2.0", true, "{}", "{}", null, null + ); +``` \ No newline at end of file diff --git a/sdk/eventhub/Azure.Management.EventHub/CHANGELOG.md b/sdk/eventhub/Azure.Management.EventHub/CHANGELOG.md index 0c771dd35ce73..02b2d2d5cbfb4 100644 --- a/sdk/eventhub/Azure.Management.EventHub/CHANGELOG.md +++ b/sdk/eventhub/Azure.Management.EventHub/CHANGELOG.md @@ -2,5 +2,135 @@ ## 1.0.0-preview.1 -### New Features -- Initial preview of Azure Management SDK based on Azure.Core \ No newline at end of file +This package follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) 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.EventHub` to `Azure.Management.EventHubs` + +#### Management Client Changes + +Example: Create an Event Hub: + +Before upgrade: +```csharp +using Microsoft.Azure.Management.EventHub; +using Microsoft.Azure.Management.EventHub.Models; + +var tokenCredentials = new TokenCredentials("YOUR ACCESS TOKEN"); +var eventHubManagementClient = new EventHubManagementClient(tokenCredentials); +eventHubManagementClient.SubscriptionId = subscriptionId; + +var createNamespaceResponse = eventHubManagementClient.Namespaces.CreateOrUpdate( + resourceGroup, + namespaceName, + new EHNamespace() + { + Location = location, + Sku = new Sku + { + Name = SkuName.Standard, + Tier = SkuTier.Standard + }, + Tags = new Dictionary() + { + {"tag1", "value1"}, + {"tag2", "value2"} + } + }); + +var createEventHubResponse = this.EventHubManagementClient.EventHubs.CreateOrUpdate( + resourceGroup, + namespaceName, + eventhubName, + new Eventhub() + { + MessageRetentionInDays = 4, + PartitionCount = 4, + Status = EntityStatus.Active, + CaptureDescription = new CaptureDescription() + { + Enabled = true, + Encoding = EncodingCaptureDescription.Avro, + IntervalInSeconds = 120, + SizeLimitInBytes = 10485763, + Destination = new Destination() + { + Name = "EventHubArchive.AzureBlockBlob", + BlobContainer = "container", + ArchiveNameFormat = "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}", + StorageAccountResourceId = "/subscriptions/" + ResourceManagementClient.SubscriptionId.ToString() + "/resourcegroups/v-ajnavtest/providers/Microsoft.Storage/storageAccounts/testingsdkeventhubnew" + }, + SkipEmptyArchives = true + } + }); +``` + +After upgrade: +```csharp +using Azure.Identity; +using Azure.Management.EventHubs; +using Azure.Management.EventHubs.Models; + +var eventHubsManagementClient = new EventHubsManagementClient(subscriptionId, new DefaultAzureCredential()); +var namespacesClient = eventHubsManagementClient.GetNamespacesClient(); +var eventHubsClient = eventHubsManagementClient.GetEventHubsClient(); + +var createNamespaceResponse = await namespacesClient.StartCreateOrUpdateAsync( + resourceGroup, + namespaceName, + new EHNamespace() + { + Location = location.Result, + Sku= new Sku(SkuName.Standard) + { + Tier = SkuTier.Standard, + }, + Tags = new Dictionary() + { + {"tag1", "value1"}, + {"tag2", "value2"} + } + }); +await createNamespaceResponse.WaitForCompletionAsync(); + +// Create Eventhub +var createEventhubResponse = await eventHubsClient.CreateOrUpdateAsync( + resourceGroup, + namespaceName, + venthubName, + new Eventhub() { MessageRetentionInDays = 5 }); +``` + +#### Object Model Changes + +Example: Create an AuthorizationRule Model + +Before upgrade: +```csharp +var createAutorizationRuleParameter = new AuthorizationRule() + { + Rights = new List() { AccessRights.Listen, AccessRights.Send } + }; +``` + +After upgrade: +```csharp +var createAutorizationRuleParameter = new AuthorizationRule() + { + Rights = new List() { AccessRights.Listen,AccessRights.Send} + }; +``` diff --git a/sdk/network/Azure.Management.Network/CHANGELOG.md b/sdk/network/Azure.Management.Network/CHANGELOG.md index 0c771dd35ce73..8fa4cf9401cf8 100644 --- a/sdk/network/Azure.Management.Network/CHANGELOG.md +++ b/sdk/network/Azure.Management.Network/CHANGELOG.md @@ -2,5 +2,110 @@ ## 1.0.0-preview.1 -### New Features -- Initial preview of Azure Management SDK based on Azure.Core \ No newline at end of file +This package follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) 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.Network` to `Azure.Management.Network` + +#### Management Client Changes + +Example: Create a VNet: + +Before upgrade: +```csharp +using Microsoft.Azure.Management.Network; +using Microsoft.Azure.Management.Network.Models; +using Microsoft.Rest; + +var credentials = new TokenCredentials("YOUR ACCESS TOKEN");; +var networkClient = new NetworkManagementClient(credentials); +networkClient.SubscriptionId = subscriptionId; + +// Create VNet +var vnet = new VirtualNetwork() +{ + Location = location, + AddressSpace = new AddressSpace() { AddressPrefixes = new List() { "10.0.0.0/16" } }, + Subnets = new List() + { + new Subnet() + { + Name = "mySubnet", + AddressPrefix = "10.0.0.0/24", + } + }, +}; + +vnet = await networkClient.VirtualNetworks + .BeginCreateOrUpdateAsync(resourceGroup, vmName + "_vent", vnet); +``` + +After upgrade: +```csharp +using Azure.Identity; +using Azure.Management.Network; +using Azure.Management.Network.Models; + +var networkClient = new NetworkManagementClient(subscriptionId, new DefaultAzureCredential()); +var virtualNetworksClient = networkClient.GetVirtualNetworksClient(); + +// Create VNet +var vnet = new VirtualNetwork() +{ + Location = location, + AddressSpace = new AddressSpace() { AddressPrefixes = new List() { "10.0.0.0/16" } }, + Subnets = new List() + { + new Subnet() + { + Name = "mySubnet", + AddressPrefix = "10.0.0.0/24", + } + }, +}; + +var response = await virtualNetworksClient.StartCreateOrUpdateAsync(resourceGroup, vmName + "_vent", vnet); +vnet = await response.WaitForCompletionAsync(); +``` + +#### Object Model Changes + +Example: Create a VirtualNetworkGatewayConnection Model + +Before upgrade: +```csharp +var virtualNetworkGatewayConnection = new VirtualNetworkGatewayConnection() + { + Location = location, + VirtualNetworkGateway1 = getVirtualNetworkGatewayResponse, + LocalNetworkGateway2 = getLocalNetworkGatewayResponse, + ConnectionType = VirtualNetworkGatewayConnectionType.IPsec, + RoutingWeight = 3, + SharedKey = "abc" + }; +``` + +After upgrade: +```csharp + var virtualNetworkGatewayConnection = new VirtualNetworkGatewayConnection(getVirtualNetworkGatewayResponse, VirtualNetworkGatewayConnectionType.IPsec) + { + Location = location, + LocalNetworkGateway2 = getLocalNetworkGatewayResponse, + RoutingWeight = 3, + SharedKey = "abc" + }; +``` diff --git a/sdk/resources/Azure.Management.Resources/CHANGELOG.md b/sdk/resources/Azure.Management.Resources/CHANGELOG.md index 1b317bfa6f40b..a0e6b67da6731 100644 --- a/sdk/resources/Azure.Management.Resources/CHANGELOG.md +++ b/sdk/resources/Azure.Management.Resources/CHANGELOG.md @@ -2,5 +2,153 @@ ## 1.0.0-preview.1 -### New Features -- Initial preview of Azure Management SDK based on Azure.Core +This package follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) 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.ResourceManager` to `Azure.Management.Resources` + +#### Management Client Changes + +Example: Create one deployment with string template and parameters: + +Before upgrade: +```csharp +using Microsoft.Azure.Management.ResourceManager; +using Microsoft.Azure.Management.ResourceManager.Models; +using Microsoft.Rest; + +var tokenCredentials = new TokenCredentials("YOUR ACCESS TOKEN"); +var resourceManagerManagementClient = new ResourceManagerManagementClient(tokenCredentials); +resourceManagerManagementClient.SubscriptionId = subscriptionId; + +var parameters = new Deployment +{ + Properties = new DeploymentProperties() + { + Template = File.ReadAllText("storage-account.json")), + Parameters = File.ReadAllText("account-parameters.json")), + Mode = DeploymentMode.Incremental, + } +}; + +client.ResourceGroups.CreateOrUpdate(groupName, new ResourceGroup { Location = location }); +client.Deployments.CreateOrUpdate(groupName, deploymentName, parameters); +``` + +storage-account.json +```json +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "storageAccountName": { + "type": "string" + } + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[parameters('storageAccountName')]", + "apiVersion": "2015-06-15", + "location": "[resourceGroup().location]", + "properties": { + "accountType": "Standard_LRS" + } + } + ], + "outputs": {} +} +``` + +account-parameters.json +```json +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "storageAccountName": { + "value": "ramokaSATestAnother" + } + } +} +``` + +After upgrade: +```csharp +using Azure.Identity; +using Azure.Management.Resources; +using Azure.Management.Resources.Models; + +var resourcesManagementClient = new ResourcesManagementClient(subscriptionId, new DefaultAzureCredential()); +var resourceGroupsClient = resourcesManagementClient.GetResourceGroupsClient(); +var deploymentsClient = resourcesManagementClient.GetDeploymentsClient(); + +var templateString = File.ReadAllText("storage-account.json"); +var parameterString = File.ReadAllText("account-parameters.json"); +JsonElement jsonParameter = JsonSerializer.Deserialize(parameterString); +if(!jsonParameter.TryGetProperty("parameters", out JsonElement parameter)) +{ + parameter = jsonParameter; +} +var parameters = new Deployment +( + new DeploymentProperties(DeploymentMode.Incremental) + { + Template = templateString, + Parameters = parameter.ToString() + } +); +await resourceGroupsClient.CreateOrUpdateAsync(groupName, new ResourceGroup(location)); +var rawResult = await deploymentsClient.StartCreateOrUpdateAsync(groupName, deploymentName, parameters); +await rawResult.WaitForCompletionAsync(); +``` + +#### Object Model Changes + +Example: Create Deployment Model + +Before upgrade: +```csharp +var parameters = new Deployment +{ + Properties = new DeploymentProperties() + { + Template = File.ReadAllText("storage-account.json")), + Parameters = File.ReadAllText("account-parameters.json")), + Mode = DeploymentMode.Incremental, + } +}; + +``` + +After upgrade: +```csharp +var parameterString = File.ReadAllText("account-parameters.json"); +JsonElement jsonParameter = JsonSerializer.Deserialize(parameterString); +if(!jsonParameter.TryGetProperty("parameters", out JsonElement parameter)) +{ + parameter = jsonParameter; +} +var parameters = new Deployment +( + new DeploymentProperties(DeploymentMode.Incremental) + { + Template = File.ReadAllText("storage-account.json");, + Parameters = parameter.ToString() + } +); +``` diff --git a/sdk/storage/Azure.Management.Storage/CHANGELOG.md b/sdk/storage/Azure.Management.Storage/CHANGELOG.md index 1b317bfa6f40b..f67922e635498 100644 --- a/sdk/storage/Azure.Management.Storage/CHANGELOG.md +++ b/sdk/storage/Azure.Management.Storage/CHANGELOG.md @@ -2,5 +2,91 @@ ## 1.0.0-preview.1 -### New Features -- Initial preview of Azure Management SDK based on Azure.Core +This package follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) 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.Storage` to `Azure.Management.Storage` + +#### Management Client Changes + +Example: Create a storage account: + +Before upgrade: +```csharp +using Microsoft.Azure.Management.Storage; +using Microsoft.Azure.Management.Storage.Models; +using Microsoft.Rest; + +var credentials = new TokenCredentials("YOUR ACCESS TOKEN"); +var storageManagementClient = new StorageManagementClient(credentials); +storageManagementClient.SubscriptionId = subscriptionId; + +StorageAccountCreateParameters parameters = new StorageAccountCreateParameters +{ + Location = location, + Tags = new Dictionary + { + {"key1","value1"}, + {"key2","value2"} + }, + Sku = new Sku { Name = SkuName.StandardGRS }, + Kind = Kind.Storage, +}; +storageManagementClient.StorageAccounts.Create(resourceGroupName, accountName, parameters); +``` + +After upgrade: +```csharp +using Azure.Identity; +using Azure.Management.Storage; +using Azure.Management.Storage.Models; + +var storageManagementClient = new StorageManagementClient(subscriptionId, new DefaultAzureCredential()); +var storageAccountsClient = storageManagementClient.GetStorageAccountsClient(); + +var parameters = new StorageAccountCreateParameters(new Sku(SkuName.StandardGRS), Kind.Storage, location) + { + Tags = new Dictionary + { + {"key1","value1"}, + {"key2","value2"} + } + }; +var accountResponse = await storageAccountsClient.StartCreateAsync(resourceGroupName, accountName, parameters); +StorageAccount account = await accountResponse.WaitForCompletionAsync(); +``` + +#### Object Model Changes + +Example: Create one Encryption Model + +Before upgrade: +```csharp +var encryption = new Encryption() + { + Services = new EncryptionServices { Blob = new EncryptionService { Enabled = true }, File = new EncryptionService { Enabled = true } }, + KeySource = KeySource.MicrosoftStorage + }; +``` + +After upgrade: +```csharp +var encryption = new Encryption(KeySource.MicrosoftStorage) + { + Services = new EncryptionServices { Blob = new EncryptionService { Enabled = true }, File = new EncryptionService { Enabled = true } } + }; +``` From 5fc395dd96ec887842b9cbb4924477af80fde37b Mon Sep 17 00:00:00 2001 From: "Erich(Renyong) Wang" Date: Tue, 2 Jun 2020 10:27:59 +0800 Subject: [PATCH 2/2] update code sample --- .../Azure.Management.Compute/CHANGELOG.md | 7 +++- .../Azure.Management.EventHub/CHANGELOG.md | 4 +- .../Azure.Management.Network/CHANGELOG.md | 42 ++++++++++--------- .../Azure.Management.Resources/CHANGELOG.md | 6 +-- .../Azure.Management.Storage/CHANGELOG.md | 4 +- 5 files changed, 35 insertions(+), 28 deletions(-) diff --git a/sdk/compute/Azure.Management.Compute/CHANGELOG.md b/sdk/compute/Azure.Management.Compute/CHANGELOG.md index 7d715c8489026..e24929ce6e6ea 100644 --- a/sdk/compute/Azure.Management.Compute/CHANGELOG.md +++ b/sdk/compute/Azure.Management.Compute/CHANGELOG.md @@ -52,6 +52,7 @@ resourceClient.SubscriptionId = subscriptionId; networkClient.SubscriptionId = subscriptionId; computeClient.SubscriptionId = subscriptionId; +var location = "westus"; // Create Resource Group await resourceClient.ResourceGroups.CreateOrUpdateAsync(resourceGroup, new ResourceGroup(location)); @@ -163,6 +164,8 @@ var availabilitySetsClient = computeClient.GetAvailabilitySetsClient(); var virtualNetworksClient = networkClient.GetVirtualNetworksClient(); var networkInterfaceClient = networkClient.GetNetworkInterfacesClient(); var virtualMachinesClient = computeClient.GetVirtualMachinesClient(); + +var location = "westus"; // Create AvailabilitySet var availabilitySet = new AvailabilitySet(location) { @@ -250,7 +253,7 @@ Before upgrade: ```csharp var vmExtension = new VirtualMachineExtension { - Location = ComputeManagementTestUtilities.DefaultLocation, + Location = "westus", Tags = new Dictionary() { { "extensionTag1", "1" }, { "extensionTag2", "2" } }, Publisher = "Microsoft.Compute", VirtualMachineExtensionType = "VMAccessAgent", @@ -270,7 +273,7 @@ var vmExtension = new VirtualMachineExtension( null, "vmext01", "Microsoft.Compute/virtualMachines/extensions", - "SoutheastAsia", + "westus", new Dictionary() { { "extensionTag1", "1" }, { "extensionTag2", "2" } }, "RerunExtension", "Microsoft.Compute", diff --git a/sdk/eventhub/Azure.Management.EventHub/CHANGELOG.md b/sdk/eventhub/Azure.Management.EventHub/CHANGELOG.md index 02b2d2d5cbfb4..05a59b1823774 100644 --- a/sdk/eventhub/Azure.Management.EventHub/CHANGELOG.md +++ b/sdk/eventhub/Azure.Management.EventHub/CHANGELOG.md @@ -39,7 +39,7 @@ var createNamespaceResponse = eventHubManagementClient.Namespaces.CreateOrUpdate namespaceName, new EHNamespace() { - Location = location, + Location = "westus", Sku = new Sku { Name = SkuName.Standard, @@ -94,7 +94,7 @@ var createNamespaceResponse = await namespacesClient.StartCreateOrUpdateAsync( namespaceName, new EHNamespace() { - Location = location.Result, + Location = "westus", Sku= new Sku(SkuName.Standard) { Tier = SkuTier.Standard, diff --git a/sdk/network/Azure.Management.Network/CHANGELOG.md b/sdk/network/Azure.Management.Network/CHANGELOG.md index 8fa4cf9401cf8..748ede9976038 100644 --- a/sdk/network/Azure.Management.Network/CHANGELOG.md +++ b/sdk/network/Azure.Management.Network/CHANGELOG.md @@ -38,7 +38,7 @@ networkClient.SubscriptionId = subscriptionId; // Create VNet var vnet = new VirtualNetwork() { - Location = location, + Location = "westus", AddressSpace = new AddressSpace() { AddressPrefixes = new List() { "10.0.0.0/16" } }, Subnets = new List() { @@ -66,7 +66,7 @@ var virtualNetworksClient = networkClient.GetVirtualNetworksClient(); // Create VNet var vnet = new VirtualNetwork() { - Location = location, + Location = "westus", AddressSpace = new AddressSpace() { AddressPrefixes = new List() { "10.0.0.0/16" } }, Subnets = new List() { @@ -84,28 +84,32 @@ vnet = await response.WaitForCompletionAsync(); #### Object Model Changes -Example: Create a VirtualNetworkGatewayConnection Model +Example: Create a IpsecPolicy Model Before upgrade: ```csharp -var virtualNetworkGatewayConnection = new VirtualNetworkGatewayConnection() - { - Location = location, - VirtualNetworkGateway1 = getVirtualNetworkGatewayResponse, - LocalNetworkGateway2 = getLocalNetworkGatewayResponse, - ConnectionType = VirtualNetworkGatewayConnectionType.IPsec, - RoutingWeight = 3, - SharedKey = "abc" - }; +var policy = new IpsecPolicy() + { + SaLifeTimeSeconds = 300, + SaDataSizeKilobytes = 1024, + IpsecEncryption = IpsecEncryption.AES128, + IpsecIntegrity = IpsecIntegrity.SHA256, + IkeEncryption = IkeEncryption.AES192, + IkeIntegrity = IkeIntegrity.SHA1, + DhGroup = DhGroup.DHGroup2, + PfsGroup = PfsGroup.PFS1, + } ``` After upgrade: ```csharp - var virtualNetworkGatewayConnection = new VirtualNetworkGatewayConnection(getVirtualNetworkGatewayResponse, VirtualNetworkGatewayConnectionType.IPsec) - { - Location = location, - LocalNetworkGateway2 = getLocalNetworkGatewayResponse, - RoutingWeight = 3, - SharedKey = "abc" - }; +var policy = new IpsecPolicy( + 300, + 1024, + IpsecEncryption.AES128, + IpsecIntegrity.SHA256, + IkeEncryption.AES192, + IkeIntegrity.SHA1, + DhGroup.DHGroup2, + PfsGroup.PFS1) ``` diff --git a/sdk/resources/Azure.Management.Resources/CHANGELOG.md b/sdk/resources/Azure.Management.Resources/CHANGELOG.md index a0e6b67da6731..661d80fd352f7 100644 --- a/sdk/resources/Azure.Management.Resources/CHANGELOG.md +++ b/sdk/resources/Azure.Management.Resources/CHANGELOG.md @@ -45,8 +45,8 @@ var parameters = new Deployment } }; -client.ResourceGroups.CreateOrUpdate(groupName, new ResourceGroup { Location = location }); -client.Deployments.CreateOrUpdate(groupName, deploymentName, parameters); +resourceManagerManagementClient.ResourceGroups.CreateOrUpdate(groupName, new ResourceGroup { Location = "westus" }); +resourceManagerManagementClient.Deployments.CreateOrUpdate(groupName, deploymentName, parameters); ``` storage-account.json @@ -112,7 +112,7 @@ var parameters = new Deployment Parameters = parameter.ToString() } ); -await resourceGroupsClient.CreateOrUpdateAsync(groupName, new ResourceGroup(location)); +await resourceGroupsClient.CreateOrUpdateAsync(groupName, new ResourceGroup("westus")); var rawResult = await deploymentsClient.StartCreateOrUpdateAsync(groupName, deploymentName, parameters); await rawResult.WaitForCompletionAsync(); ``` diff --git a/sdk/storage/Azure.Management.Storage/CHANGELOG.md b/sdk/storage/Azure.Management.Storage/CHANGELOG.md index f67922e635498..79f95a7879574 100644 --- a/sdk/storage/Azure.Management.Storage/CHANGELOG.md +++ b/sdk/storage/Azure.Management.Storage/CHANGELOG.md @@ -37,7 +37,7 @@ storageManagementClient.SubscriptionId = subscriptionId; StorageAccountCreateParameters parameters = new StorageAccountCreateParameters { - Location = location, + Location = "westus", Tags = new Dictionary { {"key1","value1"}, @@ -58,7 +58,7 @@ using Azure.Management.Storage.Models; var storageManagementClient = new StorageManagementClient(subscriptionId, new DefaultAzureCredential()); var storageAccountsClient = storageManagementClient.GetStorageAccountsClient(); -var parameters = new StorageAccountCreateParameters(new Sku(SkuName.StandardGRS), Kind.Storage, location) +var parameters = new StorageAccountCreateParameters(new Sku(SkuName.StandardGRS), Kind.Storage, "westus") { Tags = new Dictionary {