Azure SDK for Python Documentation · 8.2.7More examples •Azure Resource Viewer Web Application...

702
Azure SDK for Python Documentation Release 1.0.1 Microsoft September 14, 2015

Transcript of Azure SDK for Python Documentation · 8.2.7More examples •Azure Resource Viewer Web Application...

  • Azure SDK for Python DocumentationRelease 1.0.1

    Microsoft

    September 14, 2015

  • Contents

    1 Installation: 1

    2 Documentation: 3

    3 Features: 5

    4 System Requirements: 7

    5 Need Help?: 9

    6 Contributing: 116.1 Contribute Code or Provide Feedback: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    7 Learn More 13

    8 Indices and tables 158.1 Service Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158.2 Resource Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178.3 Resource Management Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188.4 Storage Resource Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198.5 Compute and Network Resource Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218.6 Service Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268.7 azure package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288.8 azure.common package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1648.9 azure.mgmt package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1648.10 azure.mgmt.common package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2558.11 azure.mgmt.common.arm module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2578.12 azure.mgmt.common.filters module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2578.13 azure.mgmt.compute package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2588.14 azure.mgmt.compute.computemanagement module . . . . . . . . . . . . . . . . . . . . . . . . . . . 2838.15 azure.mgmt.network package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3098.16 azure.mgmt.network.networkresourceprovider module . . . . . . . . . . . . . . . . . . . . . . . . . 3468.17 azure.mgmt.resource package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3828.18 azure.mgmt.resource.resourcemanagement module . . . . . . . . . . . . . . . . . . . . . . . . . . . 4018.19 azure.mgmt.storage package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4208.20 azure.mgmt.storage.storagemanagement module . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4278.21 azure.servicebus package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4358.22 azure.servicebus.constants module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4428.23 azure.servicebus.models module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442

    i

  • 8.24 azure.servicebus.servicebusservice module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4438.25 azure.servicemanagement package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4498.26 azure.servicemanagement.constants module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4878.27 azure.servicemanagement.models module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4878.28 azure.servicemanagement.publishsettings module . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4968.29 azure.servicemanagement.schedulermanagementservice module . . . . . . . . . . . . . . . . . . . . 4968.30 azure.servicemanagement.servicebusmanagementservice module . . . . . . . . . . . . . . . . . . . 4988.31 azure.servicemanagement.servicemanagementclient module . . . . . . . . . . . . . . . . . . . . . . 5018.32 azure.servicemanagement.servicemanagementservice module . . . . . . . . . . . . . . . . . . . . . 5028.33 azure.servicemanagement.sqldatabasemanagementservice module . . . . . . . . . . . . . . . . . . . 5208.34 azure.servicemanagement.websitemanagementservice module . . . . . . . . . . . . . . . . . . . . . 5238.35 azure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526

    Python Module Index 663

    ii

  • CHAPTER 1

    Installation:

    You can use pip to install the latest released version of azure:

    pip install azure

    If you want to install azure from source:

    git clone git://github.com/Azure/azure-sdk-for-python.gitcd azure-sdk-for-pythonpython setup.py install

    1

  • Azure SDK for Python Documentation, Release 1.0.1

    2 Chapter 1. Installation:

  • CHAPTER 2

    Documentation:

    • Resource Management – (API)

    – Compute Resource Management – (API)

    – Network Resource Management – (API)

    – Storage Resource Management – (API)

    • Service Management – (API)

    • Service Bus – (API)

    • Storage

    • All Documentation

    3

    http://azure-storage.readthedocs.org

  • Azure SDK for Python Documentation, Release 1.0.1

    4 Chapter 2. Documentation:

  • CHAPTER 3

    Features:

    • Storage Blob, File, Table, Queue

    – see the Azure storage Git repository or readthedocs for a complete list of supported features.

    • Service Bus

    – Queues: create, list and delete queues; create, list, and delete subscriptions; send, receive, unlock anddelete messages

    – Topics: create, list, and delete topics; create, list, and delete rules

    • Resource Management (Preview)

    – Compute: create virtual machines and more

    – Network: create virtual networks, network interfaces, public ips and more

    – Resource: create resource groups, register providers and more

    – Storage: create storage accounts, list keys, and more

    • Service Management

    – 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

    5

    https://github.com/Azure/azure-storage-pythonhttp://azure-storage.readthedocs.org

  • Azure SDK for Python Documentation, Release 1.0.1

    6 Chapter 3. Features:

  • CHAPTER 4

    System Requirements:

    The supported Python versions are 2.7.x, 3.3.x, and 3.4.x To download Python, please visithttps://www.python.org/download/

    We recommend Python Tools for Visual Studio as a development environment for developing your applications. Pleasevisit http://aka.ms/python for more information.

    7

    https://www.python.org/download/http://aka.ms/python

  • Azure SDK for Python Documentation, Release 1.0.1

    8 Chapter 4. System Requirements:

  • CHAPTER 5

    Need Help?:

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

    9

    http://go.microsoft.com/fwlink/?LinkId=234489

  • Azure SDK for Python Documentation, Release 1.0.1

    10 Chapter 5. Need Help?:

  • CHAPTER 6

    Contributing:

    6.1 Contribute Code or Provide Feedback:

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

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

    11

    http://windowsazure.github.com/guidelines.htmlhttp://windowsazure.github.com/guidelines.htmlhttps://github.com/Azure/azure-sdk-for-python/issues

  • Azure SDK for Python Documentation, Release 1.0.1

    12 Chapter 6. Contributing:

  • CHAPTER 7

    Learn More

    Microsoft Azure Python Developer Center

    13

    http://azure.microsoft.com/en-us/develop/python/

  • Azure SDK for Python Documentation, Release 1.0.1

    14 Chapter 7. Learn More

  • CHAPTER 8

    Indices and tables

    • genindex

    • modindex

    • search

    8.1 Service Bus

    8.1.1 ServiceBus Queues

    ServiceBus Queues are an alternative to Storage Queues that might be useful in scenarios where more advancedmessaging features are needed (larger message sizes, message ordering, single-operaiton destructive reads, scheduleddelivery) using push-style delivery (using long polling).

    The service can use Shared Access Signature authentication, or ACS authentication.

    Service bus namespaces created using the Azure portal after August 2014 no longer support ACS authentication. Youcan create ACS compatible namespaces with the Azure SDK.

    Shared Access Signature Authentication

    To use Shared Access Signature authentication, create the service bus service with:

    from azure.servicebus import ServiceBusService

    key_name = 'RootManageSharedAccessKey' # SharedAccessKeyName from Azure portalkey_value = '' # SharedAccessKey from Azure portalsbs = ServiceBusService(service_namespace,

    shared_access_key_name=key_name,shared_access_key_value=key_value)

    ACS Authentication

    To use ACS authentication, create the service bus service with:

    from azure.servicebus import ServiceBusService

    account_key = '' # DEFAULT KEY from Azure portalissuer = 'owner' # DEFAULT ISSUER from Azure portal

    15

  • Azure SDK for Python Documentation, Release 1.0.1

    sbs = ServiceBusService(service_namespace,account_key=account_key,issuer=issuer)

    Sending and Receiving Messages

    The create_queue method can be used to ensure a queue exists:

    sbs.create_queue('taskqueue')

    The send_queue_message method can then be called to insert the message into the queue:

    from azure.servicebus import Message

    msg = Message('Hello World!')sbs.send_queue_message('taskqueue', msg)

    It is then possible to call the receive_queue_message method to dequeue the message.

    msg = sbs.receive_queue_message('taskqueue')

    8.1.2 ServiceBus Topics

    ServiceBus topics are an abstraction on top of ServiceBus Queues that make pub/sub scenarios easy to implement.

    The create_topic method can be used to create a server-side topic:

    sbs.create_topic('taskdiscussion')

    The send_topic_message method can be used to send a message to a topic:

    from azure.servicebus import Message

    msg = Message('Hello World!')sbs.send_topic_message('taskdiscussion', msg)

    A client can then create a subscription and start consuming messages by calling the create_subscription methodfollowed by the receive_subscription_message method. Please note that any messages sent before the subscription iscreated will not be received.

    from azure.servicebus import Message

    sbs.create_subscription('taskdiscussion', 'client1')msg = Message('Hello World!')sbs.send_topic_message('taskdiscussion', msg)msg = sbs.receive_subscription_message('taskdiscussion', 'client1')

    8.1.3 Event Hub

    Event Hubs enable the collection of event streams at high throughput, from a diverse set of devices and services.

    The create_event_hub method can be used to create an event hub:

    sbs.create_event_hub('myhub')

    To send an event:

    16 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    sbs.send_event('myhub', '{ "DeviceId":"dev-01", "Temperature":"37.0" }')

    The event content is the event message or JSON-encoded string that contains multiple messages.

    8.2 Resource Management

    8.2.1 This is a preview release

    The ARM libraries are being released as a preview, to solicit feedback.

    Future releases are subject to breaking changes.

    The Python code generator used to create this version of the ARM libraries is being replaced, and may not generatecode that is compatible with this version of the ARM libraries.

    Although future revisions will likely have breaking changes, the ARM concepts along with the REST APIs that thelibrary is wrapping should remain the same.

    Please try the libraries and give us feedback, which we can incorporate into future versions.

    8.2.2 Compute, Network and Storage Resource Management

    The ARM libraries are separated into several packages:

    • azure-mgmt-resource

    • azure-mgmt-compute

    • azure-mgmt-network

    • azure-mgmt-storage

    See Storage Resource Management for examples of managing storage accounts.

    See Compute and Network Resource Management for examples of managing virtual machines.

    See the examples below for managing resource groups.

    8.2.3 Authentication

    All authentication with ARM is done via tokens.

    For this preview release, we support authentication with a service principal.

    In future releases, we will support additional scenarios using an ADAL library.

    See Resource Management Authentication for details on getting an authentication token.

    8.2.4 Create the management client

    The following code creates an instance of the management client.

    You will need to provide your subscription_id which can be retrieved from your subscription list.

    See Resource Management Authentication for details on getting an authentication token.

    8.2. Resource Management 17

    https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping

  • Azure SDK for Python Documentation, Release 1.0.1

    from azure.mgmt.common import SubscriptionCloudCredentialsfrom azure.mgmt.resource import ResourceManagementClient

    # TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'creds = SubscriptionCloudCredentials(subscription_id, auth_token)

    resource_client = ResourceManagementClient(creds)

    8.2.5 Create resource group

    from azure.mgmt.resource import ResourceGroup

    group_name = 'mynewresourcegroup'result = resource_client.resource_groups.create_or_update(

    group_name,ResourceGroup(

    location='westus',tags={

    'tag1': 'value1',},

    ))

    8.2.6 List resource groups

    result = resource_client.resource_groups.list(None)for group in result.resource_groups:

    print(group.name)

    8.2.7 More examples

    • Azure Resource Viewer Web Application Sample

    • Azure Resource Manager Unit tests

    Note that the ADAL library used by the Azure Resource Viewer sample hasn’t been officially released yet. Theapplication has a pre-release of ADAL in its wheelhouse folder.

    8.3 Resource Management Authentication

    For general information on resource management, see Resource Management.

    8.3.1 Create Service Principal

    First we need to create a service principal in Azure Active Directory.

    Although creating an application can be done with the Azure Portal, it is currently not possible to assign a role to theapplication using the Azure Portal.

    18 Chapter 8. Indices and tables

    https://github.com/Azure/azure-sdk-for-python/tree/master/examples/AzureResourceViewerhttps://github.com/Azure/azure-sdk-for-python/tree/master/azure-mgmt/tests

  • Azure SDK for Python Documentation, Release 1.0.1

    The following instructions use the Azure-CLI to create the application and assign a role. You can also use AzurePowerShell.

    Go to the following links to

    1. Install the Azure-CLI.

    2. Connect to the Azure-CLI.

    3. Authenticate to your Service Principal using the Azure-CLI.

    The instructions above give the application ‘Reader’ permissions. You can use the ‘Owner’ permission for moreaccess.

    If you have access to more than one Azure subscription, make sure to activate the correct subscription when usingAzure-CLI. See the azure account list and azure account set commands.

    8.3.2 Get token

    Then, use the following code to obtain an authentication token.

    import requests

    def get_token_from_client_credentials(endpoint, client_id, client_secret):payload = {

    'grant_type': 'client_credentials','client_id': client_id,'client_secret': client_secret,'resource': 'https://management.core.windows.net/',

    }response = requests.post(endpoint, data=payload).json()return response['access_token']

    In the code below:

    • Set endpoint to the value of “OAuth 2.0 Token Endpoint”. Click on VIEW ENDPOINTS on the bottomtoolbar in Azure portal, Active Directory, in APPLICATIONS page.

    • Set client_id to the value of ApplicationId when the application was created using CLI.

    • Set client_secret to the password used when the application was created using CLI.

    auth_token = get_token_from_client_credentials(endpoint='https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/token',client_id='11111111-1111-1111-1111-111111111111',client_secret='2222222222222222222222222222222222222222222=',

    )

    8.4 Storage Resource Management

    For general information on resource management, see Resource Management.

    8.4.1 Create the management client

    The following code creates an instance of the management client.

    You will need to provide your subscription_id which can be retrieved from your subscription list.

    8.4. Storage Resource Management 19

    https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-connect#use-the-publish-settings-file-methodhttps://azure.microsoft.com/en-us/documentation/articles/resource-group-authenticate-service-principal/#authenticate-service-principal-with-password---azure-clihttps://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping

  • Azure SDK for Python Documentation, Release 1.0.1

    See Resource Management Authentication for details on getting an authentication token.

    from azure.mgmt.common import SubscriptionCloudCredentialsfrom azure.mgmt.storage import StorageManagementClient

    # TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'creds = SubscriptionCloudCredentials(subscription_id, auth_token)

    storage_client = StorageManagementClient(creds)

    8.4.2 Registration

    Some operations in the storage ARM APIs require a one-time registration of the storage provider with your subscrip-tion.

    Use the following code to do the registration. You can use the same credentials you created in the previous section.

    from azure.mgmt.resource import ResourceManagementClient

    resource_client = ResourceManagementClient(creds)resource_client.providers.register('Microsoft.Storage')

    8.4.3 Create storage account

    The following code creates a new storage account under an existing resource group. To create or manage resourcegroups, see Resource Management.

    from azure.mgmt.storage import StorageAccountCreateParameters, AccountType

    group_name = 'myresourcegroup'account_name = 'mystorageaccountname'result = storage_client.storage_accounts.create(

    group_name,account_name,StorageAccountCreateParameters(

    location='westus',account_type=AccountType.standard_lrs,

    ),)

    8.4.4 List storage accounts

    group_name = 'myresourcegroup'result = storage_client.storage_accounts.list_by_resource_group(group_name)for storage_account in result.storage_accounts:

    print(storage_account.name)print(storage_account.account_type)print(storage_account.location)print(storage_account.provisioning_state)print('')

    20 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    8.4.5 Get storage account keys

    group_name = 'myresourcegroup'account_name = 'mystorageaccountname'result = storage_client.storage_accounts.list_keys(group_name, account_name)print(result.storage_account_keys.key1)print(result.storage_account_keys.key2)

    8.5 Compute and Network Resource Management

    For general information on resource management, see Resource Management.

    8.5.1 Create the management client

    The following code creates an instance of the management client.

    You will need to provide your subscription_id which can be retrieved from your subscription list.

    See Resource Management Authentication for details on getting an authentication token.

    from azure.mgmt.common import SubscriptionCloudCredentialsimport azure.mgmt.computeimport azure.mgmt.network

    # TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'creds = SubscriptionCloudCredentials(subscription_id, auth_token)

    compute_client = azure.mgmt.compute.ComputeManagementClient(creds)network_client = azure.mgmt.network.NetworkResourceProviderClient(creds)

    8.5.2 Registration

    Some operations in the compute/network ARM APIs require a one-time registration of the storage provider with yoursubscription.

    Use the following code to do the registration. You can use the same credentials you created in the previous section.

    import azure.mgmt.resource

    resource_client = azure.mgmt.resource.ResourceManagementClient(creds)resource_client.providers.register('Microsoft.Compute')resource_client.providers.register('Microsoft.Network')

    8.5.3 List images

    Use the following code to print all of the available images to use for creating virtual machines, including all skus andversions.

    region = 'eastus2'

    result_list_pub = compute_client.virtual_machine_images.list_publishers(azure.mgmt.compute.VirtualMachineImageListPublishersParameters(

    8.5. Compute and Network Resource Management 21

    https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping

  • Azure SDK for Python Documentation, Release 1.0.1

    location=region,),

    )

    for publisher in result_list_pub.resources:result_list_offers = compute_client.virtual_machine_images.list_offers(

    azure.mgmt.compute.VirtualMachineImageListOffersParameters(location=region,publisher_name=publisher.name,

    ),)

    for offer in result_list_offers.resources:result_list_skus = compute_client.virtual_machine_images.list_skus(

    azure.mgmt.compute.VirtualMachineImageListSkusParameters(location=region,publisher_name=publisher.name,offer=offer.name,

    ),)

    for sku in result_list_skus.resources:result_list = compute_client.virtual_machine_images.list(

    azure.mgmt.compute.VirtualMachineImageListParameters(location=region,publisher_name=publisher.name,offer=offer.name,skus=sku.name,

    ),)

    for version in result_list.resources:result_get = compute_client.virtual_machine_images.get(

    azure.mgmt.compute.VirtualMachineImageGetParameters(location=region,publisher_name=publisher.name,offer=offer.name,skus=sku.name,version=version.name,

    ),)

    print('PUBLISHER: {0}, OFFER: {1}, SKU: {2}, VERSION: {3}'.format(publisher.name,offer.name,sku.name,version.name,

    ))

    8.5.4 Create virtual machine

    The following code creates a new virtual machine. Creating a virtual machine involves creating a resource group,storage accounts, virtual network resources, and finally the virtual machine.

    To create or manage resource groups, see Resource Management.

    To create or manage storage accounts, see Storage Resource Management.

    22 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    import azure.mgmt.computeimport azure.mgmt.networkimport azure.mgmt.resourceimport azure.mgmt.storage

    resource_client = azure.mgmt.resource.ResourceManagementClient(creds)storage_client = azure.mgmt.storage.StorageManagementClient(creds)compute_client = azure.mgmt.compute.ComputeManagementClient(creds)network_client = azure.mgmt.network.NetworkResourceProviderClient(creds)

    BASE_NAME = 'pythonexample'

    GROUP_NAME = BASE_NAMESTORAGE_NAME = BASE_NAMEVIRTUAL_NETWORK_NAME = BASE_NAMESUBNET_NAME = BASE_NAMENETWORK_INTERFACE_NAME = BASE_NAMEVM_NAME = BASE_NAMEOS_DISK_NAME = BASE_NAMEPUBLIC_IP_NAME = BASE_NAMECOMPUTER_NAME = BASE_NAMEADMIN_USERNAME='azureadminuser'ADMIN_PASSWORD=''REGION = 'eastus2'IMAGE_PUBLISHER = 'Canonical'IMAGE_OFFER = 'UbuntuServer'IMAGE_SKU = '15.04'IMAGE_VERSION = '15.04.201508180'

    # 1. Create a resource groupresult = resource_client.resource_groups.create_or_update(

    GROUP_NAME,azure.mgmt.resource.ResourceGroup(

    location=REGION,),

    )

    # 2. Create a storage accountresult = storage_client.storage_accounts.create(

    GROUP_NAME,STORAGE_NAME,azure.mgmt.storage.StorageAccountCreateParameters(

    location=REGION,account_type=azure.mgmt.storage.AccountType.standard_lrs,

    ),)

    # 3. Create the network interface using a helper function (defined below)nic_id = create_network_interface(

    network_client,REGION,GROUP_NAME,NETWORK_INTERFACE_NAME,VIRTUAL_NETWORK_NAME,SUBNET_NAME,PUBLIC_IP_NAME,

    )

    8.5. Compute and Network Resource Management 23

  • Azure SDK for Python Documentation, Release 1.0.1

    # 4. Create the virtual machineresult = compute_client.virtual_machines.create_or_update(

    GROUP_NAME,azure.mgmt.compute.VirtualMachine(

    location=REGION,name=VM_NAME,os_profile=azure.mgmt.compute.OSProfile(

    admin_username=ADMIN_USERNAME,admin_password=ADMIN_PASSWORD,computer_name=COMPUTER_NAME,

    ),hardware_profile=azure.mgmt.compute.HardwareProfile(

    virtual_machine_size=azure.mgmt.compute.VirtualMachineSizeTypes.standard_a0),network_profile=azure.mgmt.compute.NetworkProfile(

    network_interfaces=[azure.mgmt.compute.NetworkInterfaceReference(

    reference_uri=nic_id,),

    ],),storage_profile=azure.mgmt.compute.StorageProfile(

    os_disk=azure.mgmt.compute.OSDisk(caching=azure.mgmt.compute.CachingTypes.none,create_option=azure.mgmt.compute.DiskCreateOptionTypes.from_image,name=OS_DISK_NAME,virtual_hard_disk=azure.mgmt.compute.VirtualHardDisk(

    uri='https://{0}.blob.core.windows.net/vhds/{1}.vhd'.format(STORAGE_NAME,OS_DISK_NAME,

    ),),

    ),image_reference = azure.mgmt.compute.ImageReference(

    publisher=IMAGE_PUBLISHER,offer=IMAGE_OFFER,sku=IMAGE_SKU,version=IMAGE_VERSION,

    ),),

    ),)

    # Display the public ip address# You can now connect to the machine using SSHresult = network_client.public_ip_addresses.get(GROUP_NAME, PUBLIC_IP_NAME)print('VM available at {}'.format(result.public_ip_address.ip_address))

    This is the helper function that creates the network resources, such as virtual network, public ip and network interface.

    def create_network_interface(network_client, region, group_name, interface_name,network_name, subnet_name, ip_name):

    result = network_client.virtual_networks.create_or_update(group_name,network_name,azure.mgmt.network.VirtualNetwork(

    location=region,

    24 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    address_space=azure.mgmt.network.AddressSpace(address_prefixes=[

    '10.1.0.0/16',],

    ),subnets=[

    azure.mgmt.network.Subnet(name=subnet_name,address_prefix='10.1.0.0/24',

    ),],

    ),)

    result = network_client.subnets.get(group_name, network_name, subnet_name)subnet = result.subnet

    result = network_client.public_ip_addresses.create_or_update(group_name,ip_name,azure.mgmt.network.PublicIpAddress(

    location=region,public_ip_allocation_method='Dynamic',idle_timeout_in_minutes=4,

    ),)

    result = network_client.public_ip_addresses.get(group_name, ip_name)public_ip_id = result.public_ip_address.id

    result = network_client.network_interfaces.create_or_update(group_name,interface_name,azure.mgmt.network.NetworkInterface(

    name=interface_name,location=region,ip_configurations=[

    azure.mgmt.network.NetworkInterfaceIpConfiguration(name='default',private_ip_allocation_method=azure.mgmt.network.IpAllocationMethod.dynamic,subnet=subnet,public_ip_address=azure.mgmt.network.ResourceId(

    id=public_ip_id,),

    ),],

    ),)

    result = network_client.network_interfaces.get(group_name,interface_name,

    )

    return result.network_interface.id

    8.5. Compute and Network Resource Management 25

  • Azure SDK for Python Documentation, Release 1.0.1

    8.6 Service Management

    8.6.1 Usage

    Set-up certificates

    You will need two certificates, one for the server (a .cer file) and one for the client (a .pem file).

    Using the Azure .PublishSettings certificate

    You can download your Azure publish settings file and use the certificate that is embedded in that file to create theclient certificate. The server certificate already exists, so you won’t need to upload one.

    To do this, download your publish settings then use this code to create the .pem file.

    from azure.servicemanagement import get_certificate_from_publish_settings

    subscription_id = get_certificate_from_publish_settings(publish_settings_path='MyAccount.PublishSettings',path_to_write_certificate='mycert.pem',subscription_id='00000000-0000-0000-0000-000000000000',

    )

    The subscription id parameter is optional. If there are more than one subscription in the publish settings, the first onewill be used.

    Creating and uploading new certificate with OpenSSL

    To create the .pem file using OpenSSL, execute this:

    openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

    To create the .cer certificate, execute this:

    openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer

    After you have created the certificate, you will need to upload the .cer file to Microsoft Azure via the “Upload” actionof the “Settings” tab of the management portal.

    Initialization

    To initialize the management service, pass in your subscription id and the path to the .pem file.

    from azure.servicemanagement import ServiceManagementServicesubscription_id = '00000000-0000-0000-0000-000000000000'cert_file = 'mycert.pem'sms = ServiceManagementService(subscription_id, cert_file)

    List Available Locations

    locations = sms.list_locations()for location in locations:

    print(location.name)

    26 Chapter 8. Indices and tables

    http://go.microsoft.com/fwlink/?LinkID=301775http://www.openssl.orghttp://manage.windows.com

  • Azure SDK for Python Documentation, Release 1.0.1

    Create a Storage Service

    To create a storage service, you need a name for the service (between 3 and 24 lowercase characters and unique withinMicrosoft Azure), a label (up to 100 characters, automatically encoded to base-64), and either a location or an affinitygroup.

    name = "mystorageservice"desc = namelabel = namelocation = 'West US'

    result = sms.create_storage_account(name, desc, label, location=location)

    Create a Cloud Service

    A cloud service is also known as a hosted service (from earlier versions of Microsoft Azure). The cre-ate_hosted_service method allows you to create a new hosted service by providing a hosted service name (whichmust be unique in Microsoft Azure), a label (automatically encoded to base-64), and the location or the affinity groupfor your service.

    name = "myhostedservice"desc = namelabel = namelocation = 'West US'

    result = sms.create_hosted_service(name, label, desc, location=location)

    Create a Deployment

    To make a new deployment to Azure you must store the package file in a Microsoft Azure Blob Storage account underthe same subscription as the hosted service to which the package is being uploaded. You can create a deploymentpackage with the Microsoft Azure PowerShell cmdlets, or with the cspack commandline tool.

    service_name = "myhostedservice"deployment_name = "v1"slot = 'Production'package_url = "URL_for_.cspkg_file"configuration = base64.b64encode(open(file_path, 'rb').read('path_to_.cscfg_file'))label = service_name

    result = sms.create_deployment(service_name,slot,deployment_name,package_url,label,configuration)

    operation = sms.get_operation_status(result.request_id)print('Operation status: ' + operation.status)

    8.6. Service Management 27

    https://www.windowsazure.com/en-us/develop/php/how-to-guides/powershell-cmdlets/http://msdn.microsoft.com/en-us/library/gg432988.aspx

  • Azure SDK for Python Documentation, Release 1.0.1

    8.7 azure package

    8.7.1 Subpackages

    azure.common package

    Module contents

    exception azure.common.AzureConflictHttpError(message, status_code)Bases: azure.common.AzureHttpError

    exception azure.common.AzureExceptionBases: exceptions.Exception

    exception azure.common.AzureHttpError(message, status_code)Bases: azure.common.AzureException

    exception azure.common.AzureMissingResourceHttpError(message, status_code)Bases: azure.common.AzureHttpError

    azure.mgmt package

    Subpackages

    azure.mgmt.common package

    Submodules

    azure.mgmt.common.arm moduleclass azure.mgmt.common.arm.ResourceBase(**kwargs)

    Bases: object

    locationGets the location of the resource.

    tagsGets the tags attached to the resource.

    class azure.mgmt.common.arm.ResourceBaseExtended(**kwargs)Bases: azure.mgmt.common.arm.ResourceBase

    idGets the ID of the resource.

    nameGets the name of the resource.

    typeGets the type of the resource.

    azure.mgmt.common.filters moduleclass azure.mgmt.common.filters.LogFilter(name=’azure.mgmt.common.filters’, level=10)

    Bases: object

    Log the request to a standard python logger. Example of enabling logging to the console:

    28 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    import logging logger = logging.getLogger(‘azure.mgmt.common.filters’) log-ger.setLevel(logging.DEBUG) logger.addHandler(logging.StreamHandler())

    send(prepared_request)class azure.mgmt.common.filters.RequestFilter(session)

    Bases: object

    Send the request.

    send(prepared_request)

    class azure.mgmt.common.filters.SigningFilter(creds)Bases: object

    Sign the request.

    send(prepared_request)

    class azure.mgmt.common.filters.UserAgentFilter(user_agent)Bases: object

    Add a user-agent header to the request.

    send(prepared_request)

    Module contentsclass azure.mgmt.common.AzureOperationResponse(**kwargs)

    Bases: object

    “A standard service response including an HTTP status code and request ID.class azure.mgmt.common.OperationStatus

    Bases: object

    The status of an azure long running request. The field naming doesn’t conform to the python style, so to workwith the common code-generator, which has defined the same type in C# style

    Failed = ‘Failed’resourcemanagement.py still uses these

    InProgress = ‘InProgress’

    Succeeded = ‘Succeeded’

    failed = ‘Failed’

    in_progress = ‘InProgress’

    succeeded = ‘Succeeded’

    class azure.mgmt.common.OperationStatusResponse(*args, **kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    Represent the response from a long running operation. It contains the status of the specified operation, indicatingwhether it has succeeded, is in progress, or has failed. If the operation failed, the error field includes the HTTPstatus code for the failed request, and also includes error information regarding the failure.

    class ErrorDetailsIf the asynchronous operation failed, the response body includes the HTTP status code for the failedrequest, and also includes error information regarding the failure.

    class azure.mgmt.common.Service(credentials, **kwargs)Bases: object

    Basic service

    8.7. azure package 29

  • Azure SDK for Python Documentation, Release 1.0.1

    add_filter(filter)

    base_uriGets the URI used as the base for all cloud service requests.

    credentialsGets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription IDforms part of the URI for every service call.

    send_request(http_request)

    class azure.mgmt.common.SubscriptionCloudCredentials(subscription_id, access_token, ac-cess_token_type=’Bearer’)

    Bases: object

    Contains the credentials and subscription required to connect to a azure service

    access_token

    access_token_type

    sign_request(request)

    subscription_id

    azure.mgmt.compute package

    Submodules

    azure.mgmt.compute.computemanagement moduleclass azure.mgmt.compute.computemanagement.AdditionalUnattendContent(**kwargs)

    Bases: object

    Gets or sets additional XML formatted information that can be included in the Unattend.xml file, which is usedby Windows Setup. Contents are defined by setting name, component name, and the pass in which the contentis a applied.

    component_nameGets or sets the component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup.

    contentGets or sets XML formatted content that is added to the unattend.xml file in the specified pass and compo-nent.The XML must be less than 4 KB and must include the root element for the setting or feature that isbeing inserted.

    pass_nameGets or sets the pass name. Currently, the only allowable value is oobeSystem.

    setting_nameGets or sets setting name (e.g. FirstLogonCommands, AutoLogon )

    class azure.mgmt.compute.computemanagement.ApiEntityReference(**kwargs)Bases: object

    The API entity reference.

    reference_uriGets or sets the relative URL in the previous Service Management API’s namespace. For Example: /sub-scriptions/{SubcriptionId}/resourceGroups/{ResourceGroupName}/...

    30 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    class azure.mgmt.compute.computemanagement.ApiError(**kwargs)Bases: azure.mgmt.compute.computemanagement.ApiErrorBase

    Api error.

    detailsGets or sets the Api error details

    inner_errorGets or sets the Api inner error

    class azure.mgmt.compute.computemanagement.ApiErrorBase(**kwargs)Bases: object

    Api error base.

    codeGets or sets the error code.

    messageGets or sets the error message.

    targetGets or sets the target of the particular error.

    class azure.mgmt.compute.computemanagement.AvailabilitySet(**kwargs)Bases: azure.mgmt.common.arm.ResourceBaseExtended

    Create or update Availability Set parameters.

    platform_fault_domain_countGets or sets Fault Domain count.

    platform_update_domain_countGets or sets Update Domain count.

    statusesGets or sets the resource status information.

    virtual_machines_referencesGets or sets a list containing reference to all Virtual Machines created under this Availability Set.

    class azure.mgmt.compute.computemanagement.AvailabilitySetCreateOrUpdateResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The Create Availability Set operation response.

    availability_setGets or sets the details of the Availability Set.

    class azure.mgmt.compute.computemanagement.AvailabilitySetGetResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    GET Availability Set operation response.

    availability_setGets or sets the details of the Availability Set.

    class azure.mgmt.compute.computemanagement.AvailabilitySetListResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The List Availability Set operation response.

    availability_setsGets or sets the list of availability sets

    8.7. azure package 31

  • Azure SDK for Python Documentation, Release 1.0.1

    class azure.mgmt.compute.computemanagement.AvailabilitySetOperations(client)Bases: object

    Operations for managing the availability sets in compute management. __NOTE__: An instance of this class isautomatically created for an instance of the [ComputeManagementClient]

    clientGets a reference to the Microsoft.Azure.Management.Compute.ComputeManagementClient.

    create_or_update(resource_group_name, parameters)The operation to create or update the availability set.

    Args:

    resource_group_name (string): The name of the resource group.

    parameters (AvailabilitySet): Parameters supplied to the Create Availability Set operation.

    Returns:

    AvailabilitySetCreateOrUpdateResponse: The Create Availability Set operation response.

    delete(resource_group_name, availability_set_name)The operation to delete the availability set.

    Args:

    resource_group_name (string): The name of the resource group.

    availability_set_name (string): The name of the availability set.

    Returns:

    AzureOperationResponse: A standard service response including an HTTP status code and request ID.

    get(resource_group_name, availability_set_name)The operation to get the availability set.

    Args:

    resource_group_name (string): The name of the resource group.

    availability_set_name (string): The name of the availability set.

    Returns:

    AvailabilitySetGetResponse: GET Availability Set operation response.

    list(resource_group_name)The operation to list the availability sets.

    Args:

    resource_group_name (string): The name of the resource group.

    Returns:

    AvailabilitySetListResponse: The List Availability Set operation response.

    list_available_sizes(resource_group_name, availability_set_name)Lists virtual-machine-sizes available to be used for an availability set.

    Args:

    resource_group_name (string): The name of the resource group.

    availability_set_name (string): The name of the availability set.

    Returns:

    32 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    VirtualMachineSizeListResponse: The List Virtual Machine operation response.

    class azure.mgmt.compute.computemanagement.AvailabilitySetReference(**kwargs)Bases: azure.mgmt.compute.computemanagement.ApiEntityReference

    Describes an availability set reference.

    class azure.mgmt.compute.computemanagement.CachingTypesBases: object

    The caching types of OS or data disk.

    none = ‘None’

    read_only = ‘ReadOnly’

    read_write = ‘ReadWrite’

    class azure.mgmt.compute.computemanagement.ComponentNamesBases: object

    Component names supported by AdditionalUnattendContent.

    microsoft_windows_shell_setup = ‘Microsoft-Windows-Shell-Setup’

    class azure.mgmt.compute.computemanagement.ComputeLongRunningOperationResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The Compute service response for long-running operations.

    end_timeGets the operation end time

    errorGets the operation error, if any occurred.

    outputOperation output data (raw JSON)

    start_timeGets the operation start time

    statusGets the operation status.

    tracking_operation_idGets the operation identifier.

    class azure.mgmt.compute.computemanagement.ComputeManagementClient(credentials,**kwargs)

    Bases: azure.mgmt.common.Service

    The Compute Management Client.

    api_versionGets the API version.

    availability_setsOperations for managing the availability sets in compute management.

    get_long_running_operation_status(operation_status_link)The Get Operation Status operation returns the status of the specified operation. After calling an asyn-chronous operation, you can call GetLongRunningOperationStatus to determine whether the operation hassucceeded, failed, or is still in progress.

    Args:

    8.7. azure package 33

  • Azure SDK for Python Documentation, Release 1.0.1

    operation_status_link (string): Location value returned by the Begin operation.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    long_running_operation_initial_timeoutGets or sets the initial timeout for Long Running Operations.

    long_running_operation_retry_timeoutGets or sets the retry timeout for Long Running Operations.

    usageOperations for listing usage.

    virtual_machine_extension_imagesOperations for managing the virtual machine extension images in compute management.

    virtual_machine_extensionsOperations for managing the virtual machine extensions in compute management.

    virtual_machine_imagesOperations for managing the virtual machine images in compute management.

    virtual_machine_sizesOperations for listing virtual machine sizes available in a region.

    virtual_machinesOperations for managing the virtual machines in compute management.

    class azure.mgmt.compute.computemanagement.ComputeOperationResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The compute long running operation response.

    azure_async_operationGets or sets the the Azure Async Operation Uri.

    class azure.mgmt.compute.computemanagement.ComputeOperationStatusBases: object

    The operation status.

    failed = ‘Failed’

    in_progress = ‘InProgress’

    preempted = ‘Preempted’

    succeeded = ‘Succeeded’

    class azure.mgmt.compute.computemanagement.DataDisk(**kwargs)Bases: azure.mgmt.compute.computemanagement.Disk

    Describes a data disk.

    disk_size_gbGets or sets the disk size in GB for a blank data disk to be created.

    lunGets or sets the logical unit number.

    class azure.mgmt.compute.computemanagement.DataDiskImage(**kwargs)Bases: object

    Contains the data disk images information.

    34 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    lunGets the LUN number for a data disk.This value is used to identify data disk image inside the VMImagetherefore it must be unique for each data disk.The allowed character for the value is digit.

    class azure.mgmt.compute.computemanagement.Disk(**kwargs)Bases: object

    Describes a disk.

    cachingGets or sets the caching type.

    create_optionGets or sets the create option.

    nameGets or sets the disk name.

    source_imageGets or sets the Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using itto attach to the Virtual Machine.If SourceImage is provided, the destination VirtualHardDisk should notexist.

    virtual_hard_diskGets or sets the Virtual Hard Disk.

    class azure.mgmt.compute.computemanagement.DiskCreateOptionTypesBases: object

    The create options for disks.

    attach = ‘attach’

    empty = ‘empty’

    from_image = ‘fromImage’

    class azure.mgmt.compute.computemanagement.DiskInstanceView(**kwargs)Bases: azure.mgmt.compute.computemanagement.ResourceInstanceView

    The instance view of the disk.

    nameGets or sets the disk name.

    class azure.mgmt.compute.computemanagement.HardwareProfile(**kwargs)Bases: object

    Describes a hardware profile.

    virtual_machine_sizeThe virtual machine size name.

    class azure.mgmt.compute.computemanagement.ImageReference(**kwargs)Bases: object

    The image reference.

    offerGets or sets the image offer.

    publisherGets or sets the image publisher.

    8.7. azure package 35

  • Azure SDK for Python Documentation, Release 1.0.1

    skuGets or sets the image sku.

    versionGets or sets the image version. The allowed formats are Major.Minor.Build or ‘latest’. Major, Minor andBuild being decimal numbers. Specify ‘latest’ to use the latest version of image.

    class azure.mgmt.compute.computemanagement.InnerError(**kwargs)Bases: object

    Inner error details.

    error_detailGets or sets the internal error message or exception dump.

    exception_typeGets or sets the exception type.

    class azure.mgmt.compute.computemanagement.InstanceViewStatus(**kwargs)Bases: object

    Instance view status.

    codeGets or sets the status Code.

    display_statusGets or sets the short localizable label for the status.

    levelGets or sets the level Code.

    messageGets or sets the optional detailed Message, including for alerts and error messages.

    timeGets or sets the time of the status.

    class azure.mgmt.compute.computemanagement.LinuxConfiguration(**kwargs)Bases: object

    Describes Windows Configuration of the OS Profile.

    disable_password_authenticationGets or sets whether Authentication using user name and password is allowed or not

    ssh_configurationGets or sets the SSH configuration for linux VMs

    class azure.mgmt.compute.computemanagement.ListParameters(**kwargs)Bases: object

    Specifies the parameters to be passed to List APIs.

    class azure.mgmt.compute.computemanagement.ListUsagesResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The List Usages operation response.

    usagesGets or sets the list Compute Resource Usages.

    class azure.mgmt.compute.computemanagement.NetworkInterfaceReference(**kwargs)Bases: azure.mgmt.compute.computemanagement.ApiEntityReference

    36 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    Describes a network interface reference.

    primaryGets or sets whether this is a primary NIC on a virtual machine

    class azure.mgmt.compute.computemanagement.NetworkProfile(**kwargs)Bases: object

    Describes a network profile.

    network_interfacesGets or sets the network interfaces.

    class azure.mgmt.compute.computemanagement.OSDisk(**kwargs)Bases: azure.mgmt.compute.computemanagement.Disk

    Describes an Operating System disk.

    operating_system_typeGets or sets the Operating System type.

    class azure.mgmt.compute.computemanagement.OSDiskImage(**kwargs)Bases: object

    Contains the os disk image information.

    operating_systemGets or sets the operating system of the osDiskImage.

    class azure.mgmt.compute.computemanagement.OSProfile(**kwargs)Bases: object

    Describes an OS profile.

    admin_passwordGets or sets the admin user password.

    admin_usernameGets or sets the admin user name.

    computer_nameGets or sets the computer name.

    custom_dataGets or sets a base-64 encoded string of custom data.

    linux_configurationGets or sets the Linux Configuration of the OS profile.

    secretsGets or sets the List of certificates for addition to the VM.

    windows_configurationGets or sets the Windows Configuration of the OS profile.

    class azure.mgmt.compute.computemanagement.OperatingSystemTypesBases: object

    The Operating System type.

    linux = ‘Linux’

    windows = ‘Windows’

    8.7. azure package 37

  • Azure SDK for Python Documentation, Release 1.0.1

    class azure.mgmt.compute.computemanagement.PassNamesBases: object

    Pass names supported by AdditionalUnattendContent.

    oobe_system = ‘oobeSystem’

    class azure.mgmt.compute.computemanagement.Plan(**kwargs)Bases: object

    Plan for the resource.

    nameGets or sets the plan ID.

    productGets or sets the offer ID.

    promotion_codeGets or sets the promotion code.

    publisherGets or sets the publisher ID.

    class azure.mgmt.compute.computemanagement.ProtocolTypesBases: object

    The Operating System type.

    http = ‘Http’

    https = ‘Https’

    class azure.mgmt.compute.computemanagement.ProvisioningStateTypesBases: object

    The provisioning state.

    creating = ‘Creating’

    deleting = ‘Deleting’

    failed = ‘Failed’

    succeeded = ‘Succeeded’

    updating = ‘Updating’

    class azure.mgmt.compute.computemanagement.PurchasePlan(**kwargs)Bases: object

    Used for establishing the purchase context of any 3rd Party artifact through MarketPlace.

    nameGets or sets the plan ID.

    productGets or sets the product ID.

    publisherGets or sets the publisher ID.

    class azure.mgmt.compute.computemanagement.ResourceInstanceView(**kwargs)Bases: object

    The instance view of a resource.

    38 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    statusesGets or sets the resource status information.

    class azure.mgmt.compute.computemanagement.SettingNamesBases: object

    Setting names supported by AdditionalUnattendContent.

    auto_logon = ‘AutoLogon’

    first_logon_commands = ‘FirstLogonCommands’

    class azure.mgmt.compute.computemanagement.SourceImageReference(**kwargs)Bases: azure.mgmt.compute.computemanagement.ApiEntityReference

    The source image reference.

    class azure.mgmt.compute.computemanagement.SourceVaultReference(**kwargs)Bases: azure.mgmt.compute.computemanagement.ApiEntityReference

    Contains a Source Key Vault relative URL.

    class azure.mgmt.compute.computemanagement.SshConfiguration(**kwargs)Bases: object

    SSH configuration for Linux based VMs running on Azure

    public_keysGets or sets the list of SSH public keys used to authenticate with linux based VMs

    class azure.mgmt.compute.computemanagement.SshPublicKey(**kwargs)Bases: object

    Contains information about SSH certificate public key and the path on the Linux VM where the public key isplaced.

    key_dataGets or sets Certificate public key used to authenticate with VM through SSH.The certificate must be inPem format with or without headers.

    pathGets or sets the full path on the created VM where SSH public key is stored. If the file already exists, thespecified key is appended to the file.

    class azure.mgmt.compute.computemanagement.StatusLevelTypesBases: object

    The Level of the status.

    error = ‘Error’

    info = ‘Info’

    warning = ‘Warning’

    class azure.mgmt.compute.computemanagement.StorageProfile(**kwargs)Bases: object

    Describes a storage profile.

    data_disksGets or sets the data disks.

    image_referenceGets or sets the image reference.

    8.7. azure package 39

  • Azure SDK for Python Documentation, Release 1.0.1

    os_diskGets or sets the OS disk.

    source_imageGets or sets the source image reference.

    class azure.mgmt.compute.computemanagement.Usage(**kwargs)Bases: object

    Describes Compute Resource Usage.

    current_valueGets or sets the current value of the usage.

    limitGets or sets the limit of usage.

    nameGets or sets the name of the type of usage.

    unitGets or sets an enum describing the unit of measurement.

    class azure.mgmt.compute.computemanagement.UsageName(**kwargs)Bases: object

    The Usage Names.

    localized_valueGets or sets a localized string describing the resource name.

    valueGets or sets a string describing the resource name.

    class azure.mgmt.compute.computemanagement.UsageOperations(client)Bases: object

    Operations for listing usage. __NOTE__: An instance of this class is automatically created for an instance ofthe [ComputeManagementClient]

    clientGets a reference to the Microsoft.Azure.Management.Compute.ComputeManagementClient.

    list(location)Lists compute usages for a subscription.

    Args:

    location (string): The location upon which resource usage is queried.

    Returns:

    ListUsagesResponse: The List Usages operation response.

    class azure.mgmt.compute.computemanagement.UsageUnitBases: object

    The usage unit.

    count = ‘Count’

    class azure.mgmt.compute.computemanagement.VaultCertificate(**kwargs)Bases: object

    Describes a single certificate reference in a Key Vault, and where the certificate should reside on the VM.

    40 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    certificate_storeGets or sets the Certificate store in LocalMachine to add the certificate to on Windows, leave empty onLinux.

    certificate_urlGets or sets the URL referencing a secret in a Key Vault which contains a properly formatted certificate.

    class azure.mgmt.compute.computemanagement.VaultSecretGroup(**kwargs)Bases: object

    Describes a set of certificates which are all in the same Key Vault.

    source_vaultGets or sets the Relative URL of the Key Vault containing all of the certificates in VaultCertificates.

    vault_certificatesGets or sets the list of key vault references in SourceVault which contain certificates

    class azure.mgmt.compute.computemanagement.VirtualHardDisk(**kwargs)Bases: object

    Describes the uri of a disk.

    uriGets or sets the virtual hard disk’s uri. It should be a valid Uri to a virtual hard disk.

    class azure.mgmt.compute.computemanagement.VirtualMachine(**kwargs)Bases: azure.mgmt.common.arm.ResourceBaseExtended

    Describes a Virtual Machine.

    availability_set_referenceGets or sets the reference Id of the availailbity set to which this virtual machine belongs.

    extensionsGets the virtual machine child extension resources.

    hardware_profileGets or sets the hardware profile.

    instance_viewGets the virtual machine instance view.

    network_profileGets or sets the network profile.

    os_profileGets or sets the OS profile.

    planGets or sets the purchase plan when deploying virtual machine from VM Marketplace images.

    provisioning_stateGets or sets the provisioning state, which only appears in the response.

    storage_profileGets or sets the storage profile.

    class azure.mgmt.compute.computemanagement.VirtualMachineAgentInstanceView(**kwargs)Bases: azure.mgmt.compute.computemanagement.ResourceInstanceView

    The instance view of the VM Agent running on the virtual machine.

    extension_handlersGets or sets the virtual machine extension handler instance view.

    8.7. azure package 41

  • Azure SDK for Python Documentation, Release 1.0.1

    vm_agent_versionGets or sets the VM Agent full version.

    class azure.mgmt.compute.computemanagement.VirtualMachineCaptureParameters(**kwargs)Bases: object

    Capture Virtual Machine parameters.

    destination_container_nameGets or sets the destination container name.

    overwriteGets or sets whether it overwrites destination VirtualHardDisk if true, in case of conflict.

    virtual_hard_disk_name_prefixGets or sets the captured VirtualHardDisk’s name prefix.

    class azure.mgmt.compute.computemanagement.VirtualMachineCreateOrUpdateResponse(**kwargs)Bases: azure.mgmt.compute.computemanagement.ComputeOperationResponse

    The Create Virtual Machine operation response.

    virtual_machineGets or sets details of the Virtual Machine.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtension(**kwargs)Bases: azure.mgmt.common.arm.ResourceBaseExtended

    Describes a Virtual Machine Extension.

    auto_upgrade_minor_versionGets or sets whether the extension handler should be automatically upgraded across minor versions.

    extension_typeGets or sets the type of the extension handler.

    instance_viewGets or sets the virtual machine extension instance view.

    protected_settingsGets or sets Json formatted protected settings for the extension.

    provisioning_stateGets or sets the provisioning state, which only appears in the response.

    publisherGets or sets the name of the extension handler publisher.

    settingsGets or sets Json formatted public settings for the extension.

    type_handler_versionGets or sets the type version of the extension handler.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionCreateOrUpdateResponse(**kwargs)Bases: azure.mgmt.compute.computemanagement.ComputeOperationResponse

    The compute long running operation response.

    virtual_machine_extensionGets or sets details of the Virtual Machine Extension.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionGetResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    42 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    The Get VM-Extension operation response.

    virtual_machine_extensionGets or sets details of the Virtual Machine extension.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionHandlerInstanceView(**kwargs)Bases: object

    The instance view of a virtual machine extension handler.

    statusGets or sets the extension handler status.

    typeGets or sets full type of the extension handler which includes both publisher and type.

    type_handler_versionGets or sets the type version of the extension handler.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionImage(**kwargs)Bases: azure.mgmt.compute.computemanagement.VirtualMachineImageResource

    Describes a Virtual Machine Extension Image.

    compute_roleGets or sets the type of role (IaaS or PaaS) this extension supports.

    handler_schemaGets or sets the schema defined by publisher, where extension consumers should provide settings in amatching schema.

    operating_systemGets or sets the operating system this extension supports.

    supports_multiple_extensionsGets or sets whether the handler can support multiple extensions.

    vm_scale_set_enabledGets or sets whether the extension can be used on xRP VMScaleSets.By default existing extensions areusable on scalesets, but there might be cases where a publisher wants to explicitly indicate the extension isonly enabled for CRP VMs but not VMSS.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionImageGetParameters(**kwargs)Bases: azure.mgmt.compute.computemanagement.VirtualMachineExtensionImageListVersionsParameters

    Contains the parameteres required to get a virtual machine extension image.

    versionUnique version number that distinguish each monthly release of this product. The allowed characters aredigit and period.Format: .Example: 1.0.0 or 1.1.0

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionImageGetResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The get virtual machine extension image operation response.

    virtual_machine_extension_imageGets the details of the Virtual Machine Extension Image.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionImageListTypesParameters(**kwargs)Bases: object

    Contains the parameteres required to list virtual machine extension image types.

    8.7. azure package 43

  • Azure SDK for Python Documentation, Release 1.0.1

    locationLocation of the PIR, used for orchestration and required by CSM to direct request to appropriate PIRregion. Example: westus, eastus.

    publisher_namePublisher identifier. For example: Microsoft.Windows or Canonical.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionImageListVersionsParameters(**kwargs)Bases: azure.mgmt.compute.computemanagement.VirtualMachineExtensionImageListTypesParameters

    Contains the parameteres required to list virtual machine extension image versions.

    filter_expressionODAta filter expression.https://msdn.microsoft.com/en-us/library/hh169248(v=nav.70).aspxSupportedoperatives: -eq -startswith Examples: To list the all version that begin with 1.0 $filter=startswith(name,‘1.0’) To get the latest version $filter= name eq ‘latest’

    typeUnique (across the publisher) identifier to distinguish an extension for this publisher. Example: ‘BGInfo’or ‘VMAccess’.The allowed characters are uppercase or lowercase letters, digit, hypen(-), period (.)Dot orhyphen is not allowed the end of value. Max length is 64.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionImageOperations(client)Bases: object

    Operations for managing the virtual machine extension images in compute management. __NOTE__: An in-stance of this class is automatically created for an instance of the [ComputeManagementClient]

    clientGets a reference to the Microsoft.Azure.Management.Compute.ComputeManagementClient.

    get(parameters)Gets a virtual machine extension image.

    Args:

    parameters (VirtualMachineExtensionImageGetParameters)

    Returns:

    VirtualMachineExtensionImageGetResponse: The get virtual machine extension image operation re-sponse.

    list_types(parameters)Gets a list of virtual machine extension image types.

    Args:

    parameters (VirtualMachineExtensionImageListTypesParameters)

    Returns:

    VirtualMachineImageResourceList: A list of virtual machine image resource information.

    list_versions(parameters)Gets a list of virtual machine extension image versions.

    Args:

    parameters (VirtualMachineExtensionImageListVersionsParameters)

    Returns:

    VirtualMachineImageResourceList: A list of virtual machine image resource information.

    44 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionInstanceView(**kwargs)Bases: azure.mgmt.compute.computemanagement.ResourceInstanceView

    The instance view of a virtual machine extension.

    extension_typeGets or sets the full type of the extension handler which includes both publisher and type.

    nameGets or sets the virtual machine extension name.

    sub_statusesGets or sets the resource status information.

    type_handler_versionGets or sets the type version of the extension handler.

    class azure.mgmt.compute.computemanagement.VirtualMachineExtensionOperations(client)Bases: object

    Operations for managing the virtual machine extensions in compute management. __NOTE__: An instance ofthis class is automatically created for an instance of the [ComputeManagementClient]

    begin_creating_or_updating(resource_group_name, vm_name, extension_parameters)The operation to create or update the extension.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine where the extension should be create or updated.

    extension_parameters (VirtualMachineExtension): Parameters supplied to the Create Virtual Machine Ex-tension operation.

    Returns:

    VirtualMachineExtensionCreateOrUpdateResponse: The compute long running operation response.

    begin_deleting(resource_group_name, vm_name, vm_extension_name)The operation to delete the extension.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine where the extension should be deleted.

    vm_extension_name (string): The name of the virtual machine extension.

    Returns:

    ComputeOperationResponse: The compute long running operation response.

    clientGets a reference to the Microsoft.Azure.Management.Compute.ComputeManagementClient.

    create_or_update(resource_group_name, vm_name, extension_parameters)The operation to create or update the extension.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine where the extension should be create or updated.

    8.7. azure package 45

  • Azure SDK for Python Documentation, Release 1.0.1

    extension_parameters (VirtualMachineExtension): Parameters supplied to the Create Virtual Machine Ex-tension operation.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    delete(resource_group_name, vm_name, vm_extension_name)Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine where the extension should be deleted.

    vm_extension_name (string): The name of the virtual machine extension.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    get(resource_group_name, vm_name, vm_extension_name)The operation to get the extension.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine containing the extension.

    vm_extension_name (string): The name of the virtual machine extension.

    Returns:

    VirtualMachineExtensionGetResponse: The Get VM-Extension operation response.

    get_with_instance_view(resource_group_name, vm_name, vm_extension_name)The operation to get an extension along with its instance view.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine containing the extension.

    vm_extension_name (string): The name of the virtual machine extension.

    Returns:

    VirtualMachineExtensionGetResponse: The Get VM-Extension operation response.

    class azure.mgmt.compute.computemanagement.VirtualMachineGetResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The GetVM operation response.

    virtual_machineGets or sets the details of the Virtual Machine.

    class azure.mgmt.compute.computemanagement.VirtualMachineImage(**kwargs)Bases: azure.mgmt.compute.computemanagement.VirtualMachineImageResource

    Describes a Virtual Machine Image.

    data_disk_images

    os_disk_image

    purchase_plan

    46 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    class azure.mgmt.compute.computemanagement.VirtualMachineImageGetParameters(**kwargs)Bases: azure.mgmt.compute.computemanagement.VirtualMachineImageListDetailsParameters

    Contains the parameters required to get a virtual machine image.

    versionUnique version number that distinguish each monthly release of this product. The allowed characters aredigit and period.Format: .Example: 1.0.0 or 1.1.0

    class azure.mgmt.compute.computemanagement.VirtualMachineImageGetResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The get vm image operation response.

    virtual_machine_imageGets the details of the Virtual Machine Image.

    class azure.mgmt.compute.computemanagement.VirtualMachineImageListDetailsParameters(**kwargs)Bases: azure.mgmt.compute.computemanagement.VirtualMachineImageListSkusParameters

    Contains the parameters required to list virtual machine images with details.

    skusA distinct identifier for an item in image name. For example: DataCenter or Enterprise

    class azure.mgmt.compute.computemanagement.VirtualMachineImageListOffersParameters(**kwargs)Bases: azure.mgmt.compute.computemanagement.VirtualMachineImageListPublishersParameters

    Contains the parameters required to list offers.

    publisher_namePublisher identifier. For example: Microsoft.Windows or Canonical.

    class azure.mgmt.compute.computemanagement.VirtualMachineImageListParameters(**kwargs)Bases: azure.mgmt.compute.computemanagement.VirtualMachineImageListDetailsParameters

    Contains the parameters required to list virtual machine image versions.

    filter_expressionODAta filter expression.https://msdn.microsoft.com/en-us/library/hh169248(v=nav.70).aspxSupportedoperatives: -eq -startswith Examples: To list the all version that begin with 1.0 $filter=startswith(name,‘1.0’) To get the latest version $filter= name eq ‘latest’

    class azure.mgmt.compute.computemanagement.VirtualMachineImageListPublishersParameters(**kwargs)Bases: object

    Contains the parameters required to list publishers.

    locationLocation of the PIR, used for orchestration and required by CSM to direct request to appropriate PIRregion. Example: westus, eastus.

    class azure.mgmt.compute.computemanagement.VirtualMachineImageListSkusParameters(**kwargs)Bases: azure.mgmt.compute.computemanagement.VirtualMachineImageListOffersParameters

    Contains the parameters required to list skus.

    offerUnique identifier to distinguish an image. The vmImageName must be unique within publisher’s names-pace. Example: WindowsServer2012

    class azure.mgmt.compute.computemanagement.VirtualMachineImageOperations(client)Bases: object

    8.7. azure package 47

  • Azure SDK for Python Documentation, Release 1.0.1

    Operations for managing the virtual machine images in compute management. __NOTE__: An instance of thisclass is automatically created for an instance of the [ComputeManagementClient]

    clientGets a reference to the Microsoft.Azure.Management.Compute.ComputeManagementClient.

    get(parameters)Gets a virtual machine image.

    Args:

    parameters (VirtualMachineImageGetParameters)

    Returns:

    VirtualMachineImageGetResponse: The get vm image operation response.

    list(parameters)Gets a list of virtual machine images.

    Args:

    parameters (VirtualMachineImageListParameters)

    Returns:

    VirtualMachineImageResourceList: A list of virtual machine image resource information.

    list_offers(parameters)Gets a list of virtual machine image offers.

    Args:

    parameters (VirtualMachineImageListOffersParameters)

    Returns:

    VirtualMachineImageResourceList: A list of virtual machine image resource information.

    list_publishers(parameters)Gets a list of virtual machine image publishers.

    Args:

    parameters (VirtualMachineImageListPublishersParameters)

    Returns:

    VirtualMachineImageResourceList: A list of virtual machine image resource information.

    list_skus(parameters)Gets a list of virtual machine image skus.

    Args:

    parameters (VirtualMachineImageListSkusParameters)

    Returns:

    VirtualMachineImageResourceList: A list of virtual machine image resource information.

    class azure.mgmt.compute.computemanagement.VirtualMachineImageResource(**kwargs)Bases: object

    Virtual machine image resource information.

    idGets or sets the ID of the artifact.

    48 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    locationGets or sets the location of the resource.

    nameGets or sets the name of the resource.

    class azure.mgmt.compute.computemanagement.VirtualMachineImageResourceList(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    A list of virtual machine image resource information.

    resourcesGets a list of virtual machine image resources.

    class azure.mgmt.compute.computemanagement.VirtualMachineInstanceView(**kwargs)Bases: azure.mgmt.compute.computemanagement.ResourceInstanceView

    The instance view of a virtual machine.

    disksGets or sets the the disks information.

    extensionsGets or sets the extensions information.

    platform_fault_domainGets or sets the Fault Domain count.

    platform_update_domainGets or sets the Update Domain count.

    remote_desktop_thumbprintGets or sets the Remote desktop certificate thumbprint.

    vm_agentGets or sets the VM Agent running on the virtual machine.

    class azure.mgmt.compute.computemanagement.VirtualMachineListResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The List Virtual Machine operation response.

    next_linkGets or sets the uri to fetch the next page of VMs. Call ListNext() with this to fetch the next page of VirtualMachines.

    virtual_machinesGets or sets the list of virtual machines.

    class azure.mgmt.compute.computemanagement.VirtualMachineOperations(client)Bases: object

    Operations for managing the virtual machines in compute management. __NOTE__: An instance of this classis automatically created for an instance of the [ComputeManagementClient]

    begin_capturing(resource_group_name, vm_name, parameters)Captures the VM by copying VirtualHardDisks of the VM and outputs a template that can be used to createsimilar VMs.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    8.7. azure package 49

  • Azure SDK for Python Documentation, Release 1.0.1

    parameters (VirtualMachineCaptureParameters): Parameters supplied to the Capture Virtual Machine op-eration.

    Returns:

    ComputeOperationResponse: The compute long running operation response.

    begin_creating_or_updating(resource_group_name, parameters)The operation to create or update a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    parameters (VirtualMachine): Parameters supplied to the Create Virtual Machine operation.

    Returns:

    VirtualMachineCreateOrUpdateResponse: The Create Virtual Machine operation response.

    begin_deallocating(resource_group_name, vm_name)Shuts down the Virtual Machine and releases the compute resources. You are not billed for the computeresources that this Virtual Machine uses.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    ComputeOperationResponse: The compute long running operation response.

    begin_deleting(resource_group_name, vm_name)The operation to delete a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    ComputeOperationResponse: The compute long running operation response.

    begin_powering_off(resource_group_name, vm_name)The operation to power off (stop) a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    ComputeOperationResponse: The compute long running operation response.

    begin_restarting(resource_group_name, vm_name)The operation to restart a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    50 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    Returns:

    ComputeOperationResponse: The compute long running operation response.

    begin_starting(resource_group_name, vm_name)The operation to start a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    ComputeOperationResponse: The compute long running operation response.

    capture(resource_group_name, vm_name, parameters)Captures the VM by copying VirtualHardDisks of the VM and outputs a template that can be used to createsimilar VMs.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    parameters (VirtualMachineCaptureParameters): Parameters supplied to the Capture Virtual Machine op-eration.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    clientGets a reference to the Microsoft.Azure.Management.Compute.ComputeManagementClient.

    create_or_update(resource_group_name, parameters)The operation to create or update a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    parameters (VirtualMachine): Parameters supplied to the Create Virtual Machine operation.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    deallocate(resource_group_name, vm_name)Shuts down the Virtual Machine and releases the compute resources. You are not billed for the computeresources that this Virtual Machine uses.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    delete(resource_group_name, vm_name)The operation to delete a virtual machine.

    Args:

    8.7. azure package 51

  • Azure SDK for Python Documentation, Release 1.0.1

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    generalize(resource_group_name, vm_name)Sets the state of the VM as Generalized.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    AzureOperationResponse: A standard service response including an HTTP status code and request ID.

    get(resource_group_name, vm_name)The operation to get a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    VirtualMachineGetResponse: The GetVM operation response.

    get_with_instance_view(resource_group_name, vm_name)The operation to get a virtual machine along with its instance view.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    VirtualMachineGetResponse: The GetVM operation response.

    list(resource_group_name)The operation to list virtual machines under a resource group.

    Args:

    resource_group_name (string): The name of the resource group.

    Returns:

    VirtualMachineListResponse: The List Virtual Machine operation response.

    list_all(parameters)Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the nextpage of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines.

    Args:

    parameters (ListParameters)

    Returns:

    VirtualMachineListResponse: The List Virtual Machine operation response.

    52 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    list_available_sizes(resource_group_name, vm_name)Lists virtual-machine-sizes available to be used for a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    VirtualMachineSizeListResponse: The List Virtual Machine operation response.

    list_next(next_link)Gets the next page of Virtual Machines. NextLink is obtained by making a ListAll() callwhich fetches thefirst page of Virtual Machines and a link to fetch the next page.

    Args:

    next_link (string): NextLink from the previous successful call to ListVirtualMachines operation.

    Returns:

    VirtualMachineListResponse: The List Virtual Machine operation response.

    power_off(resource_group_name, vm_name)The operation to power off (stop) a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    restart(resource_group_name, vm_name)The operation to restart a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    start(resource_group_name, vm_name)The operation to start a virtual machine.

    Args:

    resource_group_name (string): The name of the resource group.

    vm_name (string): The name of the virtual machine.

    Returns:

    ComputeLongRunningOperationResponse: The Compute service response for long-running operations.

    class azure.mgmt.compute.computemanagement.VirtualMachineReference(**kwargs)Bases: azure.mgmt.compute.computemanagement.ApiEntityReference

    Describes a virtual machine reference.

    8.7. azure package 53

  • Azure SDK for Python Documentation, Release 1.0.1

    class azure.mgmt.compute.computemanagement.VirtualMachineSize(**kwargs)Bases: object

    Describes the properties of a VM size.

    max_data_disk_countGets or sets the Maximum number of data disks allowed by a VM size.

    memory_in_mbGets or sets the Memory size supported by a VM size.

    nameGets or sets the VM size name.

    number_of_coresGets or sets the Number of cores supported by a VM size.

    os_disk_size_in_mbGets or sets the OS disk size allowed by a VM size.

    resource_disk_size_in_mbGets or sets the Resource disk size allowed by a VM size.

    class azure.mgmt.compute.computemanagement.VirtualMachineSizeListResponse(**kwargs)Bases: azure.mgmt.common.AzureOperationResponse

    The List Virtual Machine operation response.

    virtual_machine_sizesGets or sets the list of virtual machine sizes.

    class azure.mgmt.compute.computemanagement.VirtualMachineSizeOperations(client)Bases: object

    Operations for listing virtual machine sizes available in a region. __NOTE__: An instance of this class isautomatically created for an instance of the [ComputeManagementClient]

    clientGets a reference to the Microsoft.Azure.Management.Compute.ComputeManagementClient.

    list(location)Lists virtual-machine-sizes available in a location for a subscription.

    Args:

    location (string): The location upon which virtual-machine-sizes is queried.

    Returns:

    VirtualMachineSizeListResponse: The List Virtual Machine operation response.

    class azure.mgmt.compute.computemanagement.VirtualMachineSizeTypesBases: object

    The virtual machine size.

    basic_a0 = ‘Basic_A0’

    basic_a1 = ‘Basic_A1’

    basic_a2 = ‘Basic_A2’

    basic_a3 = ‘Basic_A3’

    basic_a4 = ‘Basic_A4’

    standard_a0 = ‘Standard_A0’

    54 Chapter 8. Indices and tables

  • Azure SDK for Python Documentation, Release 1.0.1

    standard_a1 = ‘Standard_A1’

    standard_a2 = ‘Standard_A2’

    standard_a3 = ‘Standard_A3’

    standard_a4 = ‘Standard_A4’

    standard_a5 = ‘Standard_A5’

    standard_a6 = ‘Standard_A6’

    standard_a7 = ‘Standard_A7’

    standard_a8 = ‘Standard_A8’

    standard_a9 = ‘Standard_A9’

    standard_g1 = ‘Standard_G1’

    standard_g2 = ‘Standard_G2’

    standard_g3 = ‘Standard_G3’

    standard_g4 = ‘Standard_G4’

    standard_g5 = ‘Standard_G5’

    class azure.mgmt.compute.computemanagement.WinRMConfiguration(**kwargs)Bases: object

    Describes Windows Remote Management configuration of the VM

    listenersGets or sets the list of Windows Remote Management listeners

    class azure.mgmt.compute.computemanagement.WinRMListener(**kwargs)Bases: object

    Describes Protocol and thumbprint of Windows Remote Management listener

    certificate_urlGets or sets the Certificate URL in KMS for Https listeners. Should be null for Http listeners.

    protocolGets or sets the Protocol used by WinRM listener. Currently only Http and Https are supported.

    class azure.mgmt.compute.computemanagement.WindowsConfiguration(**kwargs)Bases: object

    Describes Windows Configuration of the OS Profile.

    additional_unattend_contentsGets or sets the additional base-64 encoded XML formatted information that can be included in the Unat-tend.xml file.

    enable_automatic_updatesGets or sets whether Windows updates are automatically installed on the VM

    provision_vm_agentGets or sets whether VM Agent should be provisioned on the Virtual Machine.

    time_zoneGets or sets the Time Zone of the VM

    win_rm_configurationGets or sets the Windows Remote Management configuration of the VM

    8.7. azure package 55

  • Azure SDK for Python Documentation, Release 1.0.1

    Module contents

    azure.mgmt.network package

    Submodules

    azure.mgmt.network.networkresourceprovider moduleclass azure.mgmt.network.networkresourceprovider.AddressSpace(**kwargs)

    Bases: object

    AddressSpace contains an array of IP address ranges that can be used by subnets

    address_prefixesGets or sets List of address blocks reserved for this virtual network in CIDR notation

    class azure.mgmt.network.networkresourceprovider.AzureAsyncOperationResponse(**kwargs)Bases: azure.mgmt.network.networkresourceprovider.RetriableOperationResponse

    The response body contains the status of the specifie