This Repository was Deprecated in September 2022

September 29, 2022 · View on GitHub

Build Status

This Repository was Deprecated in September 2022

Thank you for the interest in this package.

If you are looking for the latest packages to interact with Azure resources, please use the following libraries: https://aka.ms/azsdk/dotnet/mgmt

Here is all of the latest packages: https://azure.github.io/azure-sdk/releases/latest/mgmt/dotnet.html

You can refer to this https://aka.ms/dotnet/t2/migration for more details about how to migrate your current code to our new SDK.

Azure Management Libraries for .NET

This README is based on the released stable version (1.38.1). If you are looking for other releases, see More Information

The Azure Management Libraries for .NET is a higher-level, object-oriented API for managing Azure resources. Libraries are built on the lower-level, request-response style auto generated clients and can run side-by-side with auto generated clients.

Table of contents

Feature Availability and Road Map

:triangular_flag_on_post: as of Version 1.38.1

Service | feature Available as GA Available as Preview Coming soon
Compute Virtual machines and VM extensions
Virtual machine scale sets
Managed disks
Azure container service (AKS) + registry + instances
Availability Zones
More Availability Zones and MSI features
Storage Storage accounts
Encryption (deprecated)
Encryption (Blob)
Encryption (File)
SQL Database Databases
Firewalls and virtual network
Elastic pools
Import, export, recover and restore dbs
Failover groups and replication links
DNS aliasing and metrics
Sync groups
Encryption protectors
More features
Networking Virtual networks
Network interfaces
IP addresses
Routing table
Network security groups
Load balancers
Application gateways
DNS
Traffic managers
Network peering
Virtual Network Gateway
Network watchers
Express Route
Application Security Groups
More application gateway features
More services Resource Manager
Key Vault
Redis
CDN
Service bus
Web apps
Function Apps
Graph RBAC
Cosmos DB
Monitor
Batch AI
Search
Event Hub
Data Lake
More Monitor features
Logic Apps
Event Grid
Fundamentals Authentication - core
Async methods
Managed Service Identity

Preview features are flagged in documentation comments in libraries. These features are subject to change. They can be modified in any way, or even removed, in the future.

Code snippets and samples

Azure Authentication

The Azure class is the simplest entry point for creating and interacting with Azure resources.

IAzure azure = Azure.Authenticate(credFile).WithDefaultSubscription();

To learn more about authentication in the Azure Libraries for .Net, see AUTH.md.

Virtual Machines

Create a Virtual Machine

You can create a virtual machine instance by using a Define() … Create() method chain.

Console.WriteLine("Creating a Windows VM");

var windowsVM = azure.VirtualMachines.Define("myWindowsVM")
    .WithRegion(Region.USEast)
    .WithNewResourceGroup(rgName)
    .WithNewPrimaryNetwork("10.0.0.0/28")
    .WithPrimaryPrivateIPAddressDynamic()
    .WithNewPrimaryPublicIPAddress("mywindowsvmdns")
    .WithPopularWindowsImage(KnownWindowsVirtualMachineImage.WindowsServer2012R2Datacenter)
    .WithAdminUsername("tirekicker")
    .WithAdminPassword(password)
    .WithSize(VirtualMachineSizeTypes.StandardD3V2)
    .Create();
	
Console.WriteLine("Created a Windows VM: " + windowsVM.Id);

Update a Virtual Machine

You can update a virtual machine instance by using an Update() … Apply() method chain.

windowsVM.Update()
    .WithNewDataDisk(20, lun, CachingTypes.ReadWrite)
    .Apply();

Create a Virtual Machine Scale Set

You can create a virtual machine scale set instance by using another Define() … Create() method chain.

var virtualMachineScaleSet = azure.VirtualMachineScaleSets.Define(vmssName)
    .WithRegion(Region.USEast)
    .WithExistingResourceGroup(rgName)
    .WithSku(VirtualMachineScaleSetSkuTypes.StandardD3v2)
    .WithExistingPrimaryNetworkSubnet(network, "Front-end")
    .WithPrimaryInternetFacingLoadBalancer(loadBalancer1)
    .WithPrimaryInternetFacingLoadBalancerBackends(backendPoolName1, backendPoolName2)
    .WithPrimaryInternetFacingLoadBalancerInboundNatPools(natPool50XXto22, natPool60XXto23)
    .WithoutPrimaryInternalLoadBalancer()
    .WithPopularLinuxImage(KnownLinuxVirtualMachineImage.UbuntuServer16_04_Lts)
    .WithRootUsername(userName)
    .WithSsh(sshKey)
    .WithNewDataDisk(100)
    .WithNewDataDisk(100, 1, CachingTypes.ReadWrite)
    .WithNewDataDisk(100, 2, CachingTypes.ReadWrite, StorageAccountTypes.StandardLRS)
    .WithCapacity(3)
    .Create();

Ready-to-run code samples for virtual machines

Service Management Scenario
Virtual Machines
Virtual Machines - parallel execution
Virtual Machine Scale Sets

Networking

Create a virtual network

You can create a virtual network by using a define() … create() method chain.

var network = networks.Define("mynetwork")
	.WithRegion(Region.USEast)
	.WithNewResourceGroup()
	.WithAddressSpace("10.0.0.0/28")
	.WithSubnet("subnet1", "10.0.0.0/29")
	.WithSubnet("subnet2", "10.0.0.8/29")
	.Create();

Create a Network Security Group

You can create a network security group instance by using another Define() … Create() method chain.

var frontEndNSG = azure.NetworkSecurityGroups.Define(frontEndNSGName)
    .WithRegion(Region.USEast)
    .WithNewResourceGroup(rgName)
    .DefineRule("ALLOW-SSH")
        .AllowInbound()
        .FromAnyAddress()
        .FromAnyPort()
        .ToAnyAddress()
        .ToPort(22)
        .WithProtocol(SecurityRuleProtocol.Tcp)
        .WithPriority(100)
        .WithDescription("Allow SSH")
        .Attach()
    .DefineRule("ALLOW-HTTP")
        .AllowInbound()
        .FromAnyAddress()
        .FromAnyPort()
        .ToAnyAddress()
        .ToPort(80)
        .WithProtocol(SecurityRuleProtocol.Tcp)
        .WithPriority(101)
        .WithDescription("Allow HTTP")
        .Attach()
    .Create();

Create an Application Gateway

You can create a application gateway instance by using another define() … create() method chain.

var applicationGateway = azure.ApplicationGateways.Define("myFirstAppGateway")
    .WithRegion(Region.USEast)
    .WithExistingResourceGroup(resourceGroup)
    // Request routing rule for HTTP from public 80 to public 8080
    .DefineRequestRoutingRule("HTTP-80-to-8080")
        .FromPublicFrontend()
        .FromFrontendHttpPort(80)
        .ToBackendHttpPort(8080)
        .ToBackendIPAddress("11.1.1.1")
        .ToBackendIPAddress("11.1.1.2")
        .ToBackendIPAddress("11.1.1.3")
        .ToBackendIPAddress("11.1.1.4")
        .Attach()
    .WithExistingPublicIPAddress(publicIpAddress)
    .Create();

Ready-to-run code samples for networking

Service Management Scenario
Networking
DNS
Private DNS
Traffic Manager
Application Gateway
Express Route

Application Services

Create a Web App

You can create a Web App instance by using another define() … create() method chain.

var webApp = azure.WebApps.Define(appName)
    .WithRegion(Region.USWest)
    .WithNewResourceGroup(rgName)
    .WithNewWindowsPlan(PricingTier.StandardS1)
    .Create();

Ready-to-run code samples for Application Services

Service Management Scenario
Web Apps on Windows
Web Apps on Linux
Functions

Databases and Storage

Create a Cosmos DB with CosmosDB Programming Model

You can create a Cosmos DB account by using a define() … create() method chain.

var documentDBAccount = azure.CosmosDBAccounts.Define(cosmosDBName)
    .WithRegion(Region.USEast)
    .WithNewResourceGroup(rgName)
    .WithKind(DatabaseAccountKind.GlobalDocumentDB)
    .WithSessionConsistency()
    .WithWriteReplication(Region.USWest)
    .WithReadReplication(Region.USCentral)
    .Create();

Create a SQL Database

You can create a SQL server instance by using another define() … create() method chain.

var sqlServer = azure.SqlServers.Define(sqlServerName)
    .WithRegion(Region.USEast)
    .WithNewResourceGroup(rgName)
    .WithAdministratorLogin(administratorLogin)
    .WithAdministratorPassword(administratorPassword)
    .WithNewFirewallRule(firewallRuleIpAddress)
    .WithNewFirewallRule(firewallRuleStartIpAddress, firewallRuleEndIpAddress)
    .Create();

Then, you can create a SQL database instance by using another define() … create() method chain.

var database = sqlServer.Databases.Define(databaseName)
    .Create();

Ready-to-run code samples for databases

Service Management Scenario
Storage
SQL Database
Cosmos DB

Other code samples

Service Management Scenario
Active Directory
Container Service
Container Registry and
Container Instances
Service Bus
Resource Groups
Redis Cache
Key Vault
Monitor
CDN
Batch AI
Search
Event Hub

Logging

Logging can be enabled by providing an implementation of IServiceClientTracingInterceptor interface.

ServiceClientTracing.AddTracingInterceptor(new LoggingTracer());
ServiceClientTracing.IsEnabled = true;

IAzure azure = Azure.Configure().WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
    .Authenticate(credFile).WithDefaultSubscription();

Download

Latest stable release

1.38.1 release builds are available on NuGet:

Azure Management LibraryPackage nameStable
Azure Management Client (wrapper package)Microsoft.Azure.Management.FluentNuGet
App Service (Web Apps and Functions)Microsoft.Azure.Management.AppService.FluentNuGet
Batch AIMicrosoft.Azure.Management.BatchAI.FluentNuGet
CDNMicrosoft.Azure.Management.Cdn.FluentNuGet
Virtual Machines, Virtual Machine Scale Sets, Azure Container ServicesMicrosoft.Azure.Management.Compute.FluentNuGet
Container InstanceMicrosoft.Azure.Management.ContainerInstance.FluentNuGet
Container RegistryMicrosoft.Azure.Management.ContainerRegistry.FluentNuGet
Container ServiceMicrosoft.Azure.Management.ContainerService.Fluent NuGet
Cosmos DBMicrosoft.Azure.Management.CosmosDB.FluentNuGet
DNSMicrosoft.Azure.Management.Dns.FluentNuGet
EventHubMicrosoft.Azure.Management.EventHub.FluentNuGet
Graph RBACMicrosoft.Azure.Management.Graph.RBAC.FluentNuGet
Key VaultMicrosoft.Azure.Management.KeyVault.FluentNuGet
LocksMicrosoft.Azure.Management.Locks.FluentNuGet
MonitorMicrosoft.Azure.Management.Monitor.FluentNuGet
MsiMicrosoft.Azure.Management.Msi.FluentNuGet
NetworkingMicrosoft.Azure.Management.Network.FluentNuGet
Redis CacheMicrosoft.Azure.Management.Redis.FluentNuGet
Resource ManagerMicrosoft.Azure.Management.ResourceManager.FluentNuGet
SearchMicrosoft.Azure.Management.Search.FluentNuGet
Service BusMicrosoft.Azure.Management.ServiceBus.FluentNuGet
SQL DatabaseMicrosoft.Azure.Management.Sql.FluentNuGet
StorageMicrosoft.Azure.Management.Storage.FluentNuGet
Traffic ManagerMicrosoft.Azure.Management.TrafficManager.FluentNuGet

Prerequisites

Upgrading from older versions

If you are migrating your code from 1.38.0 to 1.38.1, you can use these release notes for preparing your code for 1.38.1 from 1.38.0.

In general, Azure Libraries for .Net follow semantic versioning, so user code should continue working in a compatible fashion between minor versions of the same major version release train, with the following caveats:

  • methods and types that inherit from IBeta interface are not considered "generally available" and their design and functionality may change arbitrarily (including removal) in any future minor release of the libraries. To help identify such IBeta breaking changes from one minor release to the next and see how to mitigate them, see the above mentioned release notes for each release.

  • occasionally the naming and structure of "fluent" interface definitions (i.e. the ones whose names start with With*) may change between minor versions, as long as that change does not affect the fluent "flow" (the chaining of the methods in a definition or update chain).

  • the *Inner types and their methods may occasionally change their naming and structure between minor versions in breaking ways. User code should generally avoid making a reference to those types though, unless their functionality is not yet exposed by the "fluent" API.

Help and Issues

If you encounter any bugs with these libraries, please file issues via Issues or checkout StackOverflow for Azure Management Libraries for .NET.

To enable Http message tracing in your code please check logging.

Contribute Code

If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Azure Projects Contribution Guidelines.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

More Information

Previous Releases and Corresponding Repo Branches

VersionSHA1Remarks
1.38.11.38.1Tagged release for 1.38.1 version of Azure management libraries
1.381.38Tagged release for 1.38 version of Azure management libraries
1.37.11.37.1Tagged release for 1.37.1 version of Azure management libraries
1.371.37Tagged release for 1.37 version of Azure management libraries
1.36.11.36.1Tagged release for 1.36.1 version of Azure management libraries
1.361.36Tagged release for 1.36 version of Azure management libraries
1.351.35Tagged release for 1.35 version of Azure management libraries
1.341.34Tagged release for 1.34 version of Azure management libraries
1.331.33Tagged release for 1.33 version of Azure management libraries
1.321.32Tagged release for 1.32 version of Azure management libraries
1.31.11.31.1Tagged release for 1.31.1 version of Azure management libraries
1.311.31Tagged release for 1.31 version of Azure management libraries
1.301.30Tagged release for 1.30 version of Azure management libraries
1.29.11.29.1Tagged release for 1.29.1 version of Azure management libraries
1.291.29Tagged release for 1.29 version of Azure management libraries
1.28.11.28.1Tagged release for 1.28.1 version of Azure management libraries
1.281.28Tagged release for 1.28 version of Azure management libraries
1.27.21.27.2Tagged release for 1.27.2 version of Azure management libraries
1.271.27Tagged release for 1.27 version of Azure management libraries
1.26.11.26.1Tagged release for 1.26.1 version of Azure management libraries
1.261.26Tagged release for 1.26 version of Azure management libraries
1.251.25Tagged release for 1.25 version of Azure management libraries
1.241.24Tagged release for 1.24 version of Azure management libraries
1.231.23Tagged release for 1.23 version of Azure management libraries
1.221.22Tagged release for 1.22 version of Azure management libraries
1.211.21Tagged release for 1.21 version of Azure management libraries
1.201.20Tagged release for 1.20 version of Azure management libraries
1.191.19Tagged release for 1.19 version of Azure management libraries
1.181.18Tagged release for 1.18 version of Azure management libraries
1.171.17Tagged release for 1.17 version of Azure management libraries
1.161.16Tagged release for 1.16 version of Azure management libraries
1.151.15Tagged release for 1.15 version of Azure management libraries
1.141.14Tagged release for 1.14 version of Azure management libraries
1.131.13Tagged release for 1.13 version of Azure management libraries
1.111.11Tagged release for 1.11 version of Azure management libraries
1.101.10Tagged release for 1.10 version of Azure management libraries
1.91.9Tagged release for 1.9 version of Azure management libraries
1.81.8Tagged release for 1.8 version of Azure management libraries
1.71.7Tagged release for 1.7 version of Azure management libraries
1.61.6Tagged release for 1.6 version of Azure management libraries
1.41.4Tagged release for 1.4 version of Azure management libraries
1.31.3Tagged release for 1.3 version of Azure management libraries
1.21.2Tagged release for 1.2 version of Azure management libraries
1.11.1Tagged release for 1.1 version of Azure management libraries
1.01.0Tagged release for 1.0 version of Azure management libraries
1.0.0-beta51.0.0-beta5Tagged release for 1.0.0-beta5 version of Azure management libraries
1.0.0-beta41.0.0-beta4Tagged release for 1.0.0-beta4 version of Azure management libraries
1.0.0-beta31.0.0-beta3Tagged release for 1.0.0-beta3 version of Azure management libraries
AutoRestAutoRestMain branch for AutoRest generated raw clients

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.