diff --git a/sdk/appconfiguration/Azure.Management.AppConfiguration/CHANGELOG.md b/sdk/appconfiguration/Azure.Management.AppConfiguration/CHANGELOG.md index 0c771dd35ce7..bea0d3fd181c 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 0c771dd35ce7..e24929ce6e6e 100644 --- a/sdk/compute/Azure.Management.Compute/CHANGELOG.md +++ b/sdk/compute/Azure.Management.Compute/CHANGELOG.md @@ -2,5 +2,281 @@ ## 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; + +var location = "westus"; +// 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(); + +var location = "westus"; +// 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 = "westus", + 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", + "westus", + 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 0c771dd35ce7..05a59b182377 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 = "westus", + 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 = "westus", + 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 0c771dd35ce7..748ede997603 100644 --- a/sdk/network/Azure.Management.Network/CHANGELOG.md +++ b/sdk/network/Azure.Management.Network/CHANGELOG.md @@ -2,5 +2,114 @@ ## 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 = "westus", + 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 = "westus", + 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 IpsecPolicy Model + +Before upgrade: +```csharp +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 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 1b317bfa6f40..661d80fd352f 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, + } +}; + +resourceManagerManagementClient.ResourceGroups.CreateOrUpdate(groupName, new ResourceGroup { Location = "westus" }); +resourceManagerManagementClient.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("westus")); +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 1b317bfa6f40..79f95a787957 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 = "westus", + 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, "westus") + { + 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 } } + }; +```