Azure SDK for Python


The most part of this documentation has moved to

The Azure SDK for Python is a set of libraries which allow you to work on Azure for your management, runtime or data needs.

For a more general view of Azure and Python, you can go on the Python Developer Center for Azure

Example Usage

This example shows:

  • Authentication on Azure using an AD in your subscription,
  • Creation of a Resource Group and a Storage account,
  • Upload a simple “Hello world” HTML page and gives you the URL to get it.
from azure.common.credentials import UserPassCredentials
from azure.mgmt.resource import ResourceManagementClient
from import StorageManagementClient
from import CloudStorageAccount
from import ContentSettings, PublicAccess

credentials = UserPassCredentials('', 'my_smart_password')
subscription_id = '33333333-3333-3333-3333-333333333333'

resource_client = ResourceManagementClient(credentials, subscription_id)
storage_client = StorageManagementClient(credentials, subscription_id)

resource_group_name = 'my_resource_group'
storage_account_name = 'myuniquestorageaccount'


async_create = storage_client.storage_accounts.create(
        'sku': {

storage_keys = storage_client.storage_accounts.list_keys(resource_group_name, storage_account_name)
storage_keys = {v.key_name: v.value for v in storage_keys.keys}

storage_client = CloudStorageAccount(storage_account_name, storage_keys['key1'])
blob_service = storage_client.create_block_blob_service()


    b'<center><h1>Hello World!</h1></center>',

print(blob_service.make_blob_url('mycontainername', 'myblobname'))



You can install individually each library for each Azure service:

$ pip install azure-batch          # Install the latest Batch runtime library
$ pip install azure-mgmt-scheduler # Install the latest Storage management library

Preview packages can be installed using the --pre flag:

$ pip install --pre azure-mgmt-compute # will install only the latest Compute Management library

More details and information about the available libraries and their status can be found in the Installation Page

The azure meta-package

You can also install a set of Azure libraries in a single line using the azure meta-package. Since not all packages in this meta-package are published as stable yet, the azure meta-package is still in preview. However, the core packages, from code quality/completeness perspectives can at this time be considered “stable” - it will be officially labeled as such in sync with other languages as soon as possible. We are not planning on any further major changes until then.

Since it’s a preview release, you need to use the --pre flag:

$ pip install --pre azure

or directly

$ pip install azure==2.0.0rc6


The azure meta-package 1.0.3 is deprecated and is not working anymore.


Azure Resource Management

All documentation of management libraries for Azure are on this website. This includes:

  • Authorization : Permissions, roles and more
  • Batch : Manage Batch accounts and applications
  • Content Delivery Network : Profiles, endpoints creation and more
  • Cognitive Services : Create CS accounts and more
  • Commerce - Billing API : RateCard and Usage Billing API
  • Compute : Create virtual machines and more
  • Data Lake Analytics : Manage account, job, catalog and more
  • Data Lake Store : Manage account and more
  • DevTestLabs : Create labs and more
  • DNS : Create DNS zone, record set and more
  • IoTHub : Create IoTHub account and more
  • KeyVault : Create vaults and more
  • App Service : Create App plan, Web Apps, Logic Apps and more
  • Media Services : Create account and more
  • Network : Create virtual networks, network interfaces, public IPs and more
  • Notification Hubs : Namespaces, hub creation/deletion and more
  • PowerBI Embedded : Create account and more
  • Redis Cache : Create cache and more
  • Resource Management:
    • resources : create resource groups, register providers and more
    • features : manage features of provider and more
    • locks : manage resource group lock and more
    • subscriptions : manage subscriptions and more
  • Scheduler : Create job collections, create job and more
  • Server Manager : Create gateways, nodes and more
  • SQL Database : Create servers, databases nodes and more
  • Storage : Create storage accounts, list keys, and more
  • Traffic Manager : Create endpoints, profiles and more

Azure Runtime

Some documentation of data libraries are on this website. This includes:

These Azure services have Python data libraries which are directly hosted by the service team or are extensively documented on the Azure documentation website:

Azure Service Management


The Service Management SDK is deprecated and no more features will be added.

This page describes the usage and detailed features of Azure Service Management SDK. At a glance:

  • storage accounts: create, update, delete, list, regenerate keys
  • affinity groups: create, update, delete, list, get properties
  • locations: list
  • hosted services: create, update, delete, list, get properties
  • deployment: create, get, delete, swap, change configuration, update status, upgrade, rollback
  • role instance: reboot, reimage
  • discover addresses and ports for the endpoints of other role instances in your service
  • get configuration settings and access local resources
  • get role instance information for current role and other role instances
  • query and set the status of the current role

System Requirements:

The supported Python versions are 2.7.x, 3.3.x, 3.4.x, 3.5.x and 3.6.x To download Python, please visit

We recommend Python Tools for Visual Studio as a development environment for developing your applications. Please visit for more information.

Need Help?:

Be sure to check out the Microsoft Azure Developer Forums on Stack Overflow if you have trouble with the provided code.

Contribute Code or Provide Feedback:

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

If you encounter any bugs with the library please file an issue in the Issues section of the project.

Indices and tables

Management Documentation

Developer Documentation