There are many ways to programmatically talk to Azure services.

One of them is to use the Azure Management Libraries, which are basically an easy way to talk to the Azure REST API’s.

Some of the management libraries aren’t as up-to-date as I would like, but for some things, they are just very easy to use and Microsoft is working on revamping them. To start using them, you need to do a couple things:

  • Add the Azure Management Library of choice to your project. You can do this by searching for NuGet packages starting with Microsoft.Azure.Management or Microsoft.WindowsAzure.Management or just search for azure management.
    • There are lots of management libraries for almost all of the services in Azure. For instance, to work with Web Apps you can use Microsoft.WindowsAzure.Management.WebSites;
  • Download your Azure subscription publishsettings. You can do that here:
  • Open the publishsettings XML file. Here you find your subscription ID and ManagementCertificate hash:
<?xml version="1.0" encoding="utf-8"?>  
      Id="Your subscription ID"
      Name="Visual Studio Premium met MSDN"
      ManagementCertificate="Your certificate key" />
  • Create a method (somewhere in your application) that does something like this:
internal static SubscriptionCloudCredentials GetCredentials()  
            string certKey = ConfigurationManager.AppSettings["cert"];
            string subscriptionId = ConfigurationManager.AppSettings["subscriptionId"];

            return new CertificateCloudCredentials(subscriptionId, 
                new System.Security.Cryptography.X509Certificates.X509Certificate2(
  • This takes your subscriptionId and certificate hash to create SubscriptionCloudCredentials which you need to authenticate with the management libraries
  • Create a management client and feed it the credentials, like this:
WebSiteManagementClient client = new WebSiteManagementClient(credentials);  
  • That’s it! you are good to go. Now you can call methods on the client and get cracking.