Azure SDK for Python

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:

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