azure.servicemanagement.servicemanagementservice module

class azure.servicemanagement.servicemanagementservice.ServiceManagementService(subscription_id=None, cert_file=None, host='management.core.windows.net', request_session=None, timeout=65)[source]

Bases: azure.servicemanagement.servicemanagementclient._ServiceManagementClient

Initializes the management service.

subscription_id:
Subscription to manage.
cert_file:
Path to .pem certificate file (httplib), or location of the certificate in your Personal certificate store (winhttp) in the CURRENT_USERmyCertificateName format. If a request_session is specified, then this is unused.
host:
Live ServiceClient URL. Defaults to Azure public cloud.
request_session:
Session object to use for http requests. If this is specified, it replaces the default use of httplib or winhttp. Also, the cert_file parameter is unused when a session is passed in. The session object handles authentication, and as such can support multiple types of authentication: .pem certificate, oauth. For example, you can pass in a Session instance from the requests library. To use .pem certificate authentication with requests library, set the path to the .pem file on the session.cert attribute.
timeout:
Optional. Timeout for the http request, in seconds.
add_data_disk(service_name, deployment_name, role_name, lun, host_caching=None, media_link=None, disk_label=None, disk_name=None, logical_disk_size_in_gb=None, source_media_link=None)[source]

Adds a data disk to a virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
lun:
Specifies the Logical Unit Number (LUN) for the disk. The LUN specifies the slot in which the data drive appears when mounted for usage by the virtual machine. Valid LUN values are 0 through 15.
host_caching:
Specifies the platform caching behavior of data disk blob for read/write efficiency. The default vault is ReadOnly. Possible values are: None, ReadOnly, ReadWrite
media_link:
Specifies the location of the blob in Windows Azure blob store where the media for the disk is located. The blob location must belong to the storage account in the subscription specified by the <subscription-id> value in the operation call. Example: http://example.blob.core.windows.net/disks/mydisk.vhd
disk_label:
Specifies the description of the data disk. When you attach a disk, either by directly referencing a media using the MediaLink element or specifying the target disk size, you can use the DiskLabel element to customize the name property of the target data disk.
disk_name:
Specifies the name of the disk. Windows Azure uses the specified disk to create the data disk for the machine and populates this field with the disk name.
logical_disk_size_in_gb:
Specifies the size, in GB, of an empty disk to be attached to the role. The disk can be created as part of disk attach or create VM role call by specifying the value for this property. Windows Azure creates the empty disk based on size preference and attaches the newly created disk to the Role.
source_media_link:
Specifies the location of a blob in account storage which is mounted as a data disk when the virtual machine is created.
add_disk(has_operating_system, label, media_link, name, os)[source]

Adds a disk to the user image repository. The disk can be an OS disk or a data disk.

has_operating_system:
Deprecated.
label:
Specifies the description of the disk.
media_link:
Specifies the location of the blob in Windows Azure blob store where the media for the disk is located. The blob location must belong to the storage account in the current subscription specified by the <subscription-id> value in the operation call. Example: http://example.blob.core.windows.net/disks/mydisk.vhd
name:
Specifies a name for the disk. Windows Azure uses the name to identify the disk when creating virtual machines from the disk.
os:
The OS type of the disk. Possible values are: Linux, Windows
add_dns_server(service_name, deployment_name, dns_server_name, address)[source]

Adds a DNS server definition to an existing deployment.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
dns_server_name:
Specifies the name of the DNS server.
address:
Specifies the IP address of the DNS server.
add_management_certificate(public_key, thumbprint, data)[source]

The Add Management Certificate operation adds a certificate to the list of management certificates. Management certificates, which are also known as subscription certificates, authenticate clients attempting to connect to resources associated with your Windows Azure subscription.

public_key:
A base64 representation of the management certificate public key.
thumbprint:
The thumb print that uniquely identifies the management certificate.
data:
The certificate’s raw data in base-64 encoded .cer format.
add_os_image(label, media_link, name, os)[source]

Adds an OS image that is currently stored in a storage account in your subscription to the image repository.

label:
Specifies the friendly name of the image.
media_link:
Specifies the location of the blob in Windows Azure blob store where the media for the image is located. The blob location must belong to a storage account in the subscription specified by the <subscription-id> value in the operation call. Example: http://example.blob.core.windows.net/disks/mydisk.vhd
name:
Specifies a name for the OS image that Windows Azure uses to identify the image when creating one or more virtual machines.
os:
The operating system type of the OS image. Possible values are: Linux, Windows
add_role(service_name, deployment_name, role_name, system_config, os_virtual_hard_disk, network_config=None, availability_set_name=None, data_virtual_hard_disks=None, role_size=None, role_type='PersistentVMRole', resource_extension_references=None, provision_guest_agent=None, vm_image_name=None, media_location=None)[source]

Adds a virtual machine to an existing deployment.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
system_config:
Contains the metadata required to provision a virtual machine from a Windows or Linux OS image. Use an instance of WindowsConfigurationSet or LinuxConfigurationSet.
os_virtual_hard_disk:
Contains the parameters Windows Azure uses to create the operating system disk for the virtual machine. If you are creating a Virtual Machine by using a VM Image, this parameter is not used.
network_config:
Encapsulates the metadata required to create the virtual network configuration for a virtual machine. If you do not include a network configuration set you will not be able to access the VM through VIPs over the internet. If your virtual machine belongs to a virtual network you can not specify which subnet address space it resides under.
availability_set_name:
Specifies the name of an availability set to which to add the virtual machine. This value controls the virtual machine allocation in the Windows Azure environment. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability.
data_virtual_hard_disks:
Contains the parameters Windows Azure uses to create a data disk for a virtual machine.
role_size:
The size of the virtual machine to allocate. The default value is Small. Possible values are: ExtraSmall, Small, Medium, Large, ExtraLarge. The specified value must be compatible with the disk selected in the OSVirtualHardDisk values.
role_type:
The type of the role for the virtual machine. The only supported value is PersistentVMRole.
resource_extension_references:
Optional. Contains a collection of resource extensions that are to be installed on the Virtual Machine. This element is used if provision_guest_agent is set to True.
provision_guest_agent:
Optional. Indicates whether the VM Agent is installed on the Virtual Machine. To run a resource extension in a Virtual Machine, this service must be installed.
vm_image_name:
Optional. Specifies the name of the VM Image that is to be used to create the Virtual Machine. If this is specified, the system_config and network_config parameters are not used.
media_location:
Optional. Required if the Virtual Machine is being created from a published VM Image. Specifies the location of the VHD file that is created when VMImageName specifies a published VM Image.
add_service_certificate(service_name, data, certificate_format, password=None)[source]

Adds a certificate to a hosted service.

service_name:
Name of the hosted service.
data:
The base-64 encoded form of the pfx/cer file.
certificate_format:
The service certificate format.
password:
The certificate password. Default to None when using cer format.
associate_reserved_ip_address(name, service_name, deployment_name, virtual_ip_name=None)[source]

Associate an existing reservedIP to a deployment.

name:
Required. Name of the reserved IP address.
service_name:
Required. Name of the hosted service.
deployment_name:
Required. Name of the deployment.
virtual_ip_name:
Optional. Name of the VirtualIP in case of multi Vip tenant. If this value is not specified default virtualIP is used for this operation.
capture_role(service_name, deployment_name, role_name, post_capture_action, target_image_name, target_image_label, provisioning_configuration=None)[source]

The Capture Role operation captures a virtual machine image to your image gallery. From the captured image, you can create additional customized virtual machines.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
post_capture_action:
Specifies the action after capture operation completes. Possible values are: Delete, Reprovision.
target_image_name:
Specifies the image name of the captured virtual machine.
target_image_label:
Specifies the friendly name of the captured virtual machine.
provisioning_configuration:
Use an instance of WindowsConfigurationSet or LinuxConfigurationSet.
capture_vm_image(service_name, deployment_name, role_name, options)[source]

Creates a copy of the operating system virtual hard disk (VHD) and all of the data VHDs that are associated with the Virtual Machine, saves the VHD copies in the same storage location as the original VHDs, and registers the copies as a VM Image in the image repository that is associated with the specified subscription.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
options:
An instance of CaptureRoleAsVMImage class.
options.os_state:
Required. Specifies the state of the operating system in the image. Possible values are: Generalized, Specialized A Virtual Machine that is fully configured and running contains a Specialized operating system. A Virtual Machine on which the Sysprep command has been run with the generalize option contains a Generalized operating system. If you capture an image from a generalized Virtual Machine, the machine is deleted after the image is captured. It is recommended that all Virtual Machines are shut down before capturing an image.
options.vm_image_name:
Required. Specifies the name of the VM Image.
options.vm_image_label:
Required. Specifies the label of the VM Image.
options.description:
Optional. Specifies the description of the VM Image.
options.language:
Optional. Specifies the language of the VM Image.
options.image_family:
Optional. Specifies a value that can be used to group VM Images.
options.recommended_vm_size:
Optional. Specifies the size to use for the Virtual Machine that is created from the VM Image.
change_deployment_configuration(service_name, deployment_name, configuration, treat_warnings_as_error=False, mode='Auto', extended_properties=None)[source]

Initiates a change to the deployment configuration.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
configuration:
The base-64 encoded service configuration file for the deployment.
treat_warnings_as_error:
Indicates whether to treat package validation warnings as errors. If set to true, the Created Deployment operation fails if there are validation warnings on the service package.
mode:
If set to Manual, WalkUpgradeDomain must be called to apply the update. If set to Auto, the Windows Azure platform will automatically apply the update To each upgrade domain for the service. Possible values are: Auto, Manual
extended_properties:
Dictionary containing name/value pairs of storage account properties. You can have a maximum of 50 extended property name/value pairs. The maximum length of the Name element is 64 characters, only alphanumeric characters and underscores are valid in the Name, and the name must start with a letter. The value has a maximum length of 255 characters.
check_hosted_service_name_availability(service_name)[source]

Checks to see if the specified hosted service name is available, or if it has already been taken.

service_name:
Name of the hosted service.
check_storage_account_name_availability(service_name)[source]

Checks to see if the specified storage account name is available, or if it has already been taken.

service_name:
Name of the storage service account.
create_affinity_group(name, label, location, description=None)[source]

Creates a new affinity group for the specified subscription.

name:
A name for the affinity group that is unique to the subscription.
label:
A name for the affinity group. The name can be up to 100 characters in length.
location:
The data center location where the affinity group will be created. To list available locations, use the list_location function.
description:
A description for the affinity group. The description can be up to 1024 characters in length.
create_deployment(service_name, deployment_slot, name, package_url, label, configuration, start_deployment=False, treat_warnings_as_error=False, extended_properties=None)[source]

Uploads a new service package and creates a new deployment on staging or production.

service_name:
Name of the hosted service.
deployment_slot:
The environment to which the hosted service is deployed. Valid values are: staging, production
name:
The name for the deployment. The deployment name must be unique among other deployments for the hosted service.
package_url:
A URL that refers to the location of the service package in the Blob service. The service package can be located either in a storage account beneath the same subscription or a Shared Access Signature (SAS) URI from any storage account.
label:
A name for the hosted service. The name can be up to 100 characters in length. It is recommended that the label be unique within the subscription. The name can be used to identify the hosted service for your tracking purposes.
configuration:
The base-64 encoded service configuration file for the deployment.
start_deployment:
Indicates whether to start the deployment immediately after it is created. If false, the service model is still deployed to the virtual machines but the code is not run immediately. Instead, the service is Suspended until you call Update Deployment Status and set the status to Running, at which time the service will be started. A deployed service still incurs charges, even if it is suspended.
treat_warnings_as_error:
Indicates whether to treat package validation warnings as errors. If set to true, the Created Deployment operation fails if there are validation warnings on the service package.
extended_properties:
Dictionary containing name/value pairs of storage account properties. You can have a maximum of 50 extended property name/value pairs. The maximum length of the Name element is 64 characters, only alphanumeric characters and underscores are valid in the Name, and the name must start with a letter. The value has a maximum length of 255 characters.
create_hosted_service(service_name, label, description=None, location=None, affinity_group=None, extended_properties=None)[source]

Creates a new hosted service in Windows Azure.

service_name:
A name for the hosted service that is unique within Windows Azure. This name is the DNS prefix name and can be used to access the hosted service.
label:
A name for the hosted service. The name can be up to 100 characters in length. The name can be used to identify the storage account for your tracking purposes.
description:
A description for the hosted service. The description can be up to 1024 characters in length.
location:
The location where the hosted service will be created. You can specify either a location or affinity_group, but not both.
affinity_group:
The name of an existing affinity group associated with this subscription. This name is a GUID and can be retrieved by examining the name element of the response body returned by list_affinity_groups. You can specify either a location or affinity_group, but not both.
extended_properties:
Dictionary containing name/value pairs of storage account properties. You can have a maximum of 50 extended property name/value pairs. The maximum length of the Name element is 64 characters, only alphanumeric characters and underscores are valid in the Name, and the name must start with a letter. The value has a maximum length of 255 characters.
create_reserved_ip_address(name, label=None, location=None)[source]

Reserves an IPv4 address for the specified subscription.

name:
Required. Specifies the name for the reserved IP address.
label:
Optional. Specifies a label for the reserved IP address. The label can be up to 100 characters long and can be used for your tracking purposes.
location:
Required. Specifies the location of the reserved IP address. This should be the same location that is assigned to the cloud service containing the deployment that will use the reserved IP address. To see the available locations, you can use list_locations.
create_storage_account(service_name, description, label, affinity_group=None, location=None, geo_replication_enabled=None, extended_properties=None, account_type='Standard_GRS')[source]

Creates a new storage account in Windows Azure.

service_name:
A name for the storage account that is unique within Windows Azure. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
description:
A description for the storage account. The description may be up to 1024 characters in length.
label:
A name for the storage account. The name may be up to 100 characters in length. The name can be used to identify the storage account for your tracking purposes.
affinity_group:
The name of an existing affinity group in the specified subscription. You can specify either a location or affinity_group, but not both.
location:
The location where the storage account is created. You can specify either a location or affinity_group, but not both.
geo_replication_enabled:
Deprecated. Replaced by the account_type parameter.
extended_properties:
Dictionary containing name/value pairs of storage account properties. You can have a maximum of 50 extended property name/value pairs. The maximum length of the Name element is 64 characters, only alphanumeric characters and underscores are valid in the Name, and the name must start with a letter. The value has a maximum length of 255 characters.
account_type:

Specifies whether the account supports locally-redundant storage, geo-redundant storage, zone-redundant storage, or read access geo-redundant storage. Possible values are:

Standard_LRS, Standard_ZRS, Standard_GRS, Standard_RAGRS
create_virtual_machine_deployment(service_name, deployment_name, deployment_slot, label, role_name, system_config, os_virtual_hard_disk, network_config=None, availability_set_name=None, data_virtual_hard_disks=None, role_size=None, role_type='PersistentVMRole', virtual_network_name=None, resource_extension_references=None, provision_guest_agent=None, vm_image_name=None, media_location=None, dns_servers=None, reserved_ip_name=None)[source]

Provisions a virtual machine based on the supplied configuration.

service_name:
Name of the hosted service.
deployment_name:
The name for the deployment. The deployment name must be unique among other deployments for the hosted service.
deployment_slot:
The environment to which the hosted service is deployed. Valid values are: staging, production
label:
Specifies an identifier for the deployment. The label can be up to 100 characters long. The label can be used for tracking purposes.
role_name:
The name of the role.
system_config:
Contains the metadata required to provision a virtual machine from a Windows or Linux OS image. Use an instance of WindowsConfigurationSet or LinuxConfigurationSet.
os_virtual_hard_disk:
Contains the parameters Windows Azure uses to create the operating system disk for the virtual machine. If you are creating a Virtual Machine by using a VM Image, this parameter is not used.
network_config:
Encapsulates the metadata required to create the virtual network configuration for a virtual machine. If you do not include a network configuration set you will not be able to access the VM through VIPs over the internet. If your virtual machine belongs to a virtual network you can not specify which subnet address space it resides under. Use an instance of ConfigurationSet.
availability_set_name:
Specifies the name of an availability set to which to add the virtual machine. This value controls the virtual machine allocation in the Windows Azure environment. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability.
data_virtual_hard_disks:
Contains the parameters Windows Azure uses to create a data disk for a virtual machine.
role_size:
The size of the virtual machine to allocate. The default value is Small. Possible values are: ExtraSmall,Small,Medium,Large, ExtraLarge,A5,A6,A7,A8,A9,Basic_A0,Basic_A1,Basic_A2,Basic_A3, Basic_A4,Standard_D1,Standard_D2,Standard_D3,Standard_D4, Standard_D11,Standard_D12,Standard_D13,Standard_D14,Standard_G1, Standard_G2,Sandard_G3,Standard_G4,Standard_G5. The specified value must be compatible with the disk selected in the OSVirtualHardDisk values.
role_type:
The type of the role for the virtual machine. The only supported value is PersistentVMRole.
virtual_network_name:
Specifies the name of an existing virtual network to which the deployment will belong.
resource_extension_references:
Optional. Contains a collection of resource extensions that are to be installed on the Virtual Machine. This element is used if provision_guest_agent is set to True. Use an iterable of instances of ResourceExtensionReference.
provision_guest_agent:
Optional. Indicates whether the VM Agent is installed on the Virtual Machine. To run a resource extension in a Virtual Machine, this service must be installed.
vm_image_name:
Optional. Specifies the name of the VM Image that is to be used to create the Virtual Machine. If this is specified, the system_config and network_config parameters are not used.
media_location:
Optional. Required if the Virtual Machine is being created from a published VM Image. Specifies the location of the VHD file that is created when VMImageName specifies a published VM Image.
dns_servers:
Optional. List of DNS servers (use DnsServer class) to associate with the Virtual Machine.
reserved_ip_name:
Optional. Specifies the name of a reserved IP address that is to be assigned to the deployment. You must run create_reserved_ip_address before you can assign the address to the deployment using this element.
create_vm_image(vm_image)[source]

Creates a VM Image in the image repository that is associated with the specified subscription using a specified set of virtual hard disks.

vm_image:
An instance of VMImage class.

vm_image.name: Required. Specifies the name of the image. vm_image.label: Required. Specifies an identifier for the image. vm_image.description: Optional. Specifies the description of the image. vm_image.os_disk_configuration:

Required. Specifies configuration information for the operating system disk that is associated with the image.
vm_image.os_disk_configuration.host_caching:
Optional. Specifies the caching behavior of the operating system disk. Possible values are: None, ReadOnly, ReadWrite
vm_image.os_disk_configuration.os_state:
Required. Specifies the state of the operating system in the image. Possible values are: Generalized, Specialized A Virtual Machine that is fully configured and running contains a Specialized operating system. A Virtual Machine on which the Sysprep command has been run with the generalize option contains a Generalized operating system.
vm_image.os_disk_configuration.os:
Required. Specifies the operating system type of the image.
vm_image.os_disk_configuration.media_link:
Required. Specifies the location of the blob in Windows Azure storage. The blob location belongs to a storage account in the subscription specified by the <subscription-id> value in the operation call.
vm_image.data_disk_configurations:
Optional. Specifies configuration information for the data disks that are associated with the image. A VM Image might not have data disks associated with it.
vm_image.data_disk_configurations[].host_caching:
Optional. Specifies the caching behavior of the data disk. Possible values are: None, ReadOnly, ReadWrite
vm_image.data_disk_configurations[].lun:
Optional if the lun for the disk is 0. Specifies the Logical Unit Number (LUN) for the data disk.
vm_image.data_disk_configurations[].media_link:
Required. Specifies the location of the blob in Windows Azure storage. The blob location belongs to a storage account in the subscription specified by the <subscription-id> value in the operation call.
vm_image.data_disk_configurations[].logical_size_in_gb:
Required. Specifies the size, in GB, of the data disk.

vm_image.language: Optional. Specifies the language of the image. vm_image.image_family:

Optional. Specifies a value that can be used to group VM Images.
vm_image.recommended_vm_size:
Optional. Specifies the size to use for the Virtual Machine that is created from the VM Image.
vm_image.eula:
Optional. Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA.
vm_image.icon_uri:
Optional. Specifies the URI to the icon that is displayed for the image in the Management Portal.
vm_image.small_icon_uri:
Optional. Specifies the URI to the small icon that is displayed for the image in the Management Portal.
vm_image.privacy_uri:
Optional. Specifies the URI that points to a document that contains the privacy policy related to the image.
vm_image.published_date:
Optional. Specifies the date when the image was added to the image repository.
vm_image.show_in_gui:
Optional. Indicates whether the VM Images should be listed in the portal.
delete_affinity_group(affinity_group_name)[source]

Deletes an affinity group in the specified subscription.

affinity_group_name:
The name of the affinity group.
delete_data_disk(service_name, deployment_name, role_name, lun, delete_vhd=False)[source]

Removes the specified data disk from a virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
lun:
The Logical Unit Number (LUN) for the disk.
delete_vhd:
Deletes the underlying vhd blob in Azure storage.
delete_deployment(service_name, deployment_name, delete_vhd=False)[source]

Deletes the specified deployment.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
delete_disk(disk_name, delete_vhd=False)[source]

Deletes the specified data or operating system disk from your image repository.

disk_name:
The name of the disk to delete.
delete_vhd:
Deletes the underlying vhd blob in Azure storage.
delete_dns_server(service_name, deployment_name, dns_server_name)[source]

Deletes a DNS server from a deployment.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
dns_server_name:
Name of the DNS server that you want to delete.
delete_hosted_service(service_name, complete=False)[source]

Deletes the specified hosted service from Windows Azure.

service_name:
Name of the hosted service.
complete:
True if all OS/data disks and the source blobs for the disks should also be deleted from storage.
delete_management_certificate(thumbprint)[source]

The Delete Management Certificate operation deletes a certificate from the list of management certificates. Management certificates, which are also known as subscription certificates, authenticate clients attempting to connect to resources associated with your Windows Azure subscription.

thumbprint:
The thumb print that uniquely identifies the management certificate.
delete_os_image(image_name, delete_vhd=False)[source]

Deletes the specified OS image from your image repository.

image_name:
The name of the image.
delete_vhd:
Deletes the underlying vhd blob in Azure storage.
delete_reserved_ip_address(name)[source]

Deletes a reserved IP address from the specified subscription.

name:
Required. Name of the reserved IP address.
delete_role(service_name, deployment_name, role_name, complete=False)[source]

Deletes the specified virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
complete:
True if all OS/data disks and the source blobs for the disks should also be deleted from storage.
delete_role_instances(service_name, deployment_name, role_instance_names)[source]

Reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use reimage_role_instance.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
role_instance_names:
List of role instance names.
delete_service_certificate(service_name, thumbalgorithm, thumbprint)[source]

Deletes a service certificate from the certificate store of a hosted service.

service_name:
Name of the hosted service.
thumbalgorithm:
The algorithm for the certificate’s thumbprint.
thumbprint:
The hexadecimal representation of the thumbprint.
delete_storage_account(service_name)[source]

Deletes the specified storage account from Windows Azure.

service_name:
Name of the storage service account.
delete_vm_image(vm_image_name, delete_vhd=False)[source]

Deletes the specified VM Image from the image repository that is associated with the specified subscription.

vm_image_name:
The name of the image.
delete_vhd:
Deletes the underlying vhd blob in Azure storage.
disassociate_reserved_ip_address(name, service_name, deployment_name, virtual_ip_name=None)[source]

Disassociate an existing reservedIP from the given deployment.

name:
Required. Name of the reserved IP address.
service_name:
Required. Name of the hosted service.
deployment_name:
Required. Name of the deployment.
virtual_ip_name:
Optional. Name of the VirtualIP in case of multi Vip tenant. If this value is not specified default virtualIP is used for this operation.
get_affinity_group_properties(affinity_group_name)[source]

Returns the system properties associated with the specified affinity group.

affinity_group_name:
The name of the affinity group.
get_data_disk(service_name, deployment_name, role_name, lun)[source]

Retrieves the specified data disk from a virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
lun:
The Logical Unit Number (LUN) for the disk.
get_deployment_by_name(service_name, deployment_name)[source]

Returns configuration information, status, and system properties for a deployment.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
get_deployment_by_slot(service_name, deployment_slot)[source]

Returns configuration information, status, and system properties for a deployment.

service_name:
Name of the hosted service.
deployment_slot:
The environment to which the hosted service is deployed. Valid values are: staging, production
get_disk(disk_name)[source]

Retrieves a disk from your image repository.

get_hosted_service_properties(service_name, embed_detail=False)[source]

Retrieves system properties for the specified hosted service. These properties include the service name and service type; the name of the affinity group to which the service belongs, or its location if it is not part of an affinity group; and optionally, information on the service’s deployments.

service_name:
Name of the hosted service.
embed_detail:
When True, the management service returns properties for all deployments of the service, as well as for the service itself.
get_management_certificate(thumbprint)[source]

The Get Management Certificate operation retrieves information about the management certificate with the specified thumbprint. Management certificates, which are also known as subscription certificates, authenticate clients attempting to connect to resources associated with your Windows Azure subscription.

thumbprint:
The thumbprint value of the certificate.
get_os_image(image_name)[source]

Retrieves an OS image from the image repository.

get_os_image_details(image_name)[source]

Retrieves an OS image from the image repository, including replication progress.

get_reserved_ip_address(name)[source]

Retrieves information about the specified reserved IP address.

name:
Required. Name of the reserved IP address.
get_role(service_name, deployment_name, role_name)[source]

Retrieves the specified virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
get_service_certificate(service_name, thumbalgorithm, thumbprint)[source]

Returns the public data for the specified X.509 certificate associated with a hosted service.

service_name:
Name of the hosted service.
thumbalgorithm:
The algorithm for the certificate’s thumbprint.
thumbprint:
The hexadecimal representation of the thumbprint.
get_storage_account_keys(service_name)[source]

Returns the primary and secondary access keys for the specified storage account.

service_name:
Name of the storage service account.
get_storage_account_properties(service_name)[source]

Returns system properties for the specified storage account.

service_name:
Name of the storage service account.
get_subscription()[source]

Returns account and resource allocation information on the specified subscription.

list_affinity_groups()[source]

Lists the affinity groups associated with the specified subscription.

list_disks()[source]

Retrieves a list of the disks in your image repository.

list_hosted_services()[source]

Lists the hosted services available under the current subscription.

Note that you will receive a list of HostedService instances, without all details inside. For instance, deployments will be None. If you want deployments information for a specific host service, you have to call get_hosted_service_properties with embed_detail=True.

list_locations()[source]

Lists all of the data center locations that are valid for your subscription.

list_management_certificates()[source]

The List Management Certificates operation lists and returns basic information about all of the management certificates associated with the specified subscription. Management certificates, which are also known as subscription certificates, authenticate clients attempting to connect to resources associated with your Windows Azure subscription.

list_operating_system_families()[source]

Lists the guest operating system families available in Windows Azure, and also lists the operating system versions available for each family.

list_operating_systems()[source]

Lists the versions of the guest operating system that are currently available in Windows Azure.

list_os_images()[source]

Retrieves a list of the OS images from the image repository.

list_reserved_ip_addresses()[source]

Lists the IP addresses that have been reserved for the specified subscription.

list_resource_extension_versions(publisher_name, extension_name)[source]

Lists the versions of a resource extension that are available to add to a Virtual Machine.

publisher_name:
Name of the resource extension publisher.
extension_name:
Name of the resource extension.
list_resource_extensions()[source]

Lists the resource extensions that are available to add to a Virtual Machine.

list_role_sizes()[source]

Lists the role sizes that are available under the specified subscription.

list_service_certificates(service_name)[source]

Lists all of the service certificates associated with the specified hosted service.

service_name:
Name of the hosted service.
list_storage_accounts()[source]

Lists the storage accounts available under the current subscription.

list_subscription_operations(start_time=None, end_time=None, object_id_filter=None, operation_result_filter=None, continuation_token=None)[source]

List subscription operations.

start_time: Required. An ISO8601 date. end_time: Required. An ISO8601 date. object_id_filter: Optional. Returns subscription operations only for the specified object type and object ID operation_result_filter: Optional. Returns subscription operations only for the specified result status, either Succeeded, Failed, or InProgress. continuation_token: Optional. More information at: https://msdn.microsoft.com/en-us/library/azure/gg715318.aspx

list_subscriptions()[source]

Returns a list of subscriptions that you can access.

You must make sure that the request that is made to the management service is secure using an Active Directory access token.

list_virtual_network_sites()[source]

Retrieves a list of the virtual networks.

list_vm_images(location=None, publisher=None, category=None)[source]

Retrieves a list of the VM Images from the image repository that is associated with the specified subscription.

reboot_role_instance(service_name, deployment_name, role_instance_name)[source]

Requests a reboot of a role instance that is running in a deployment.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
role_instance_name:
The name of the role instance.
rebuild_role_instance(service_name, deployment_name, role_instance_name)[source]

Reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use reimage_role_instance.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
role_instance_name:
The name of the role instance.
regenerate_storage_account_keys(service_name, key_type)[source]

Regenerates the primary or secondary access key for the specified storage account.

service_name:
Name of the storage service account.
key_type:
Specifies which key to regenerate. Valid values are: Primary, Secondary
reimage_role_instance(service_name, deployment_name, role_instance_name)[source]

Requests a reimage of a role instance that is running in a deployment.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
role_instance_name:
The name of the role instance.
replicate_vm_image(vm_image_name, regions, offer, sku, version)[source]

Replicate a VM image to multiple target locations. This operation is only for publishers. You have to be registered as image publisher with Microsoft Azure to be able to call this.

vm_image_name:
Specifies the name of the VM Image that is to be used for replication
regions:
Specified a list of regions to replicate the image to Note: The regions in the request body are not additive. If a VM Image has already been replicated to Regions A, B, and C, and a request is made to replicate to Regions A and D, the VM Image will remain in Region A, will be replicated in Region D, and will be unreplicated from Regions B and C
offer:
Specifies the publisher defined name of the offer. The allowed characters are uppercase or lowercase letters, digit, hypen(-), period (.).The maximum allowed length is 64 characters.
sku:
Specifies the publisher defined name of the Sku. The allowed characters are uppercase or lowercase letters, digit, hypen(-), period (.). The maximum allowed length is 64 characters.
version:
Specifies the publisher defined version of the image. The allowed characters are digit and period. Format: <MajorVersion>.<MinorVersion>.<Patch> Example: ‘1.0.0’ or ‘1.1.0’ The 3 version number to follow standard of most of the RPs. See http://semver.org
restart_role(service_name, deployment_name, role_name)[source]

Restarts the specified virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
rollback_update_or_upgrade(service_name, deployment_name, mode, force)[source]

Cancels an in progress configuration change (update) or upgrade and returns the deployment to its state before the upgrade or configuration change was started.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
mode:
Specifies whether the rollback should proceed automatically.

auto - The rollback proceeds without further user input. manual - You must call the Walk Upgrade Domain operation to

apply the rollback to each upgrade domain.
force:
Specifies whether the rollback should proceed even when it will cause local data to be lost from some role instances. True if the rollback should proceed; otherwise false if the rollback should fail.
share_vm_image(vm_image_name, permission)[source]

Share an already replicated OS image. This operation is only for publishers. You have to be registered as image publisher with Windows Azure to be able to call this.

vm_image_name:
The name of the virtual machine image to share
permission:
The sharing permission: public, msdn, or private
shutdown_role(service_name, deployment_name, role_name, post_shutdown_action='Stopped')[source]

Shuts down the specified virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
post_shutdown_action:
Specifies how the Virtual Machine should be shut down. Values are:
Stopped
Shuts down the Virtual Machine but retains the compute resources. You will continue to be billed for the resources that the stopped machine uses.
StoppedDeallocated
Shuts down the Virtual Machine and releases the compute resources. You are not billed for the compute resources that this Virtual Machine uses. If a static Virtual Network IP address is assigned to the Virtual Machine, it is reserved.
shutdown_roles(service_name, deployment_name, role_names, post_shutdown_action='Stopped')[source]

Shuts down the specified virtual machines.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_names:
The names of the roles, as an enumerable of strings.
post_shutdown_action:
Specifies how the Virtual Machine should be shut down. Values are:
Stopped
Shuts down the Virtual Machine but retains the compute resources. You will continue to be billed for the resources that the stopped machine uses.
StoppedDeallocated
Shuts down the Virtual Machine and releases the compute resources. You are not billed for the compute resources that this Virtual Machine uses. If a static Virtual Network IP address is assigned to the Virtual Machine, it is reserved.
start_role(service_name, deployment_name, role_name)[source]

Starts the specified virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
start_roles(service_name, deployment_name, role_names)[source]

Starts the specified virtual machines.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_names:
The names of the roles, as an enumerable of strings.
swap_deployment(service_name, production, source_deployment)[source]

Initiates a virtual IP swap between the staging and production deployment environments for a service. If the service is currently running in the staging environment, it will be swapped to the production environment. If it is running in the production environment, it will be swapped to staging.

service_name:
Name of the hosted service.
production:
The name of the production deployment.
source_deployment:
The name of the source deployment.
unreplicate_vm_image(vm_image_name)[source]

Unreplicate a VM image from all regions This operation is only for publishers. You have to be registered as image publisher with Microsoft Azure to be able to call this

vm_image_name:
Specifies the name of the VM Image that is to be used for unreplication. The VM Image Name should be the user VM Image, not the published name of the VM Image.
update_affinity_group(affinity_group_name, label, description=None)[source]

Updates the label and/or the description for an affinity group for the specified subscription.

affinity_group_name:
The name of the affinity group.
label:
A name for the affinity group. The name can be up to 100 characters in length.
description:
A description for the affinity group. The description can be up to 1024 characters in length.
update_data_disk(service_name, deployment_name, role_name, lun, host_caching=None, media_link=None, updated_lun=None, disk_label=None, disk_name=None, logical_disk_size_in_gb=None)[source]

Updates the specified data disk attached to the specified virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
lun:
Specifies the Logical Unit Number (LUN) for the disk. The LUN specifies the slot in which the data drive appears when mounted for usage by the virtual machine. Valid LUN values are 0 through 15.
host_caching:
Specifies the platform caching behavior of data disk blob for read/write efficiency. The default vault is ReadOnly. Possible values are: None, ReadOnly, ReadWrite
media_link:
Specifies the location of the blob in Windows Azure blob store where the media for the disk is located. The blob location must belong to the storage account in the subscription specified by the <subscription-id> value in the operation call. Example: http://example.blob.core.windows.net/disks/mydisk.vhd
updated_lun:
Specifies the Logical Unit Number (LUN) for the disk. The LUN specifies the slot in which the data drive appears when mounted for usage by the virtual machine. Valid LUN values are 0 through 15.
disk_label:
Specifies the description of the data disk. When you attach a disk, either by directly referencing a media using the MediaLink element or specifying the target disk size, you can use the DiskLabel element to customize the name property of the target data disk.
disk_name:
Specifies the name of the disk. Windows Azure uses the specified disk to create the data disk for the machine and populates this field with the disk name.
logical_disk_size_in_gb:
Specifies the size, in GB, of an empty disk to be attached to the role. The disk can be created as part of disk attach or create VM role call by specifying the value for this property. Windows Azure creates the empty disk based on size preference and attaches the newly created disk to the Role.
update_deployment_status(service_name, deployment_name, status)[source]

Initiates a change in deployment status.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
status:

The change to initiate to the deployment status. Possible values include:

Running, Suspended
update_disk(disk_name, has_operating_system=None, label=None, media_link=None, name=None, os=None)[source]

Updates an existing disk in your image repository.

disk_name:
The name of the disk to update.
has_operating_system:
Deprecated.
label:
Specifies the description of the disk.
media_link:
Deprecated.
name:
Deprecated.
os:
Deprecated.
update_dns_server(service_name, deployment_name, dns_server_name, address)[source]

Updates the ip address of a DNS server.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
dns_server_name:
Specifies the name of the DNS server.
address:
Specifies the IP address of the DNS server.
update_hosted_service(service_name, label=None, description=None, extended_properties=None)[source]

Updates the label and/or the description for a hosted service in Windows Azure.

service_name:
Name of the hosted service.
label:
A name for the hosted service. The name may be up to 100 characters in length. You must specify a value for either Label or Description, or for both. It is recommended that the label be unique within the subscription. The name can be used identify the hosted service for your tracking purposes.
description:
A description for the hosted service. The description may be up to 1024 characters in length. You must specify a value for either Label or Description, or for both.
extended_properties:
Dictionary containing name/value pairs of storage account properties. You can have a maximum of 50 extended property name/value pairs. The maximum length of the Name element is 64 characters, only alphanumeric characters and underscores are valid in the Name, and the name must start with a letter. The value has a maximum length of 255 characters.
update_os_image(image_name, label, media_link, name, os)[source]

Updates an OS image that in your image repository.

image_name:
The name of the image to update.
label:
Specifies the friendly name of the image to be updated. You cannot use this operation to update images provided by the Windows Azure platform.
media_link:
Specifies the location of the blob in Windows Azure blob store where the media for the image is located. The blob location must belong to a storage account in the subscription specified by the <subscription-id> value in the operation call. Example: http://example.blob.core.windows.net/disks/mydisk.vhd
name:
Specifies a name for the OS image that Windows Azure uses to identify the image when creating one or more VM Roles.
os:
The operating system type of the OS image. Possible values are: Linux, Windows
update_os_image_from_image_reference(image_name, os_image)[source]

Updates metadata elements from a given OS image reference.

image_name:
The name of the image to update.
os_image:
An instance of OSImage class.

os_image.label: Optional. Specifies an identifier for the image. os_image.description: Optional. Specifies the description of the image. os_image.language: Optional. Specifies the language of the image. os_image.image_family:

Optional. Specifies a value that can be used to group VM Images.
os_image.recommended_vm_size:
Optional. Specifies the size to use for the Virtual Machine that is created from the VM Image.
os_image.eula:
Optional. Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA.
os_image.icon_uri:
Optional. Specifies the URI to the icon that is displayed for the image in the Management Portal.
os_image.small_icon_uri:
Optional. Specifies the URI to the small icon that is displayed for the image in the Management Portal.
os_image.privacy_uri:
Optional. Specifies the URI that points to a document that contains the privacy policy related to the image.
os_image.published_date:
Optional. Specifies the date when the image was added to the image repository.
os.image.media_link:
Required: Specifies the location of the blob in Windows Azure blob store where the media for the image is located. The blob location must belong to a storage account in the subscription specified by the <subscription-id> value in the operation call. Example: http://example.blob.core.windows.net/disks/mydisk.vhd
os_image.name:
Specifies a name for the OS image that Windows Azure uses to identify the image when creating one or more VM Roles.
os_image.os:
The operating system type of the OS image. Possible values are: Linux, Windows
update_role(service_name, deployment_name, role_name, os_virtual_hard_disk=None, network_config=None, availability_set_name=None, data_virtual_hard_disks=None, role_size=None, role_type='PersistentVMRole', resource_extension_references=None, provision_guest_agent=None)[source]

Updates the specified virtual machine.

service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
The name of the role.
os_virtual_hard_disk:
Contains the parameters Windows Azure uses to create the operating system disk for the virtual machine.
network_config:
Encapsulates the metadata required to create the virtual network configuration for a virtual machine. If you do not include a network configuration set you will not be able to access the VM through VIPs over the internet. If your virtual machine belongs to a virtual network you can not specify which subnet address space it resides under.
availability_set_name:
Specifies the name of an availability set to which to add the virtual machine. This value controls the virtual machine allocation in the Windows Azure environment. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability.
data_virtual_hard_disks:
Contains the parameters Windows Azure uses to create a data disk for a virtual machine.
role_size:
The size of the virtual machine to allocate. The default value is Small. Possible values are: ExtraSmall, Small, Medium, Large, ExtraLarge. The specified value must be compatible with the disk selected in the OSVirtualHardDisk values.
role_type:
The type of the role for the virtual machine. The only supported value is PersistentVMRole.
resource_extension_references:
Optional. Contains a collection of resource extensions that are to be installed on the Virtual Machine. This element is used if provision_guest_agent is set to True.
provision_guest_agent:
Optional. Indicates whether the VM Agent is installed on the Virtual Machine. To run a resource extension in a Virtual Machine, this service must be installed.
update_storage_account(service_name, description=None, label=None, geo_replication_enabled=None, extended_properties=None, account_type='Standard_GRS')[source]

Updates the label, the description, and enables or disables the geo-replication status for a storage account in Windows Azure.

service_name:
Name of the storage service account.
description:
A description for the storage account. The description may be up to 1024 characters in length.
label:
A name for the storage account. The name may be up to 100 characters in length. The name can be used to identify the storage account for your tracking purposes.
geo_replication_enabled:
Deprecated. Replaced by the account_type parameter.
extended_properties:
Dictionary containing name/value pairs of storage account properties. You can have a maximum of 50 extended property name/value pairs. The maximum length of the Name element is 64 characters, only alphanumeric characters and underscores are valid in the Name, and the name must start with a letter. The value has a maximum length of 255 characters.
account_type:

Specifies whether the account supports locally-redundant storage, geo-redundant storage, zone-redundant storage, or read access geo-redundant storage. Possible values are:

Standard_LRS, Standard_ZRS, Standard_GRS, Standard_RAGRS
update_vm_image(vm_image_name, vm_image)[source]

Updates a VM Image in the image repository that is associated with the specified subscription.

vm_image_name:
Name of image to update.
vm_image:
An instance of VMImage class.

vm_image.label: Optional. Specifies an identifier for the image. vm_image.os_disk_configuration:

Required. Specifies configuration information for the operating system disk that is associated with the image.
vm_image.os_disk_configuration.host_caching:
Optional. Specifies the caching behavior of the operating system disk. Possible values are: None, ReadOnly, ReadWrite
vm_image.data_disk_configurations:
Optional. Specifies configuration information for the data disks that are associated with the image. A VM Image might not have data disks associated with it.
vm_image.data_disk_configurations[].name:
Required. Specifies the name of the data disk.
vm_image.data_disk_configurations[].host_caching:
Optional. Specifies the caching behavior of the data disk. Possible values are: None, ReadOnly, ReadWrite
vm_image.data_disk_configurations[].lun:
Optional if the lun for the disk is 0. Specifies the Logical Unit Number (LUN) for the data disk.

vm_image.description: Optional. Specifies the description of the image. vm_image.language: Optional. Specifies the language of the image. vm_image.image_family:

Optional. Specifies a value that can be used to group VM Images.
vm_image.recommended_vm_size:
Optional. Specifies the size to use for the Virtual Machine that is created from the VM Image.
vm_image.eula:
Optional. Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA.
vm_image.icon_uri:
Optional. Specifies the URI to the icon that is displayed for the image in the Management Portal.
vm_image.small_icon_uri:
Optional. Specifies the URI to the small icon that is displayed for the image in the Management Portal.
vm_image.privacy_uri:
Optional. Specifies the URI that points to a document that contains the privacy policy related to the image.
vm_image.published_date:
Optional. Specifies the date when the image was added to the image repository.
vm_image.show_in_gui:
Optional. Indicates whether the VM Images should be listed in the portal.
upgrade_deployment(service_name, deployment_name, mode, package_url, configuration, label, force, role_to_upgrade=None, extended_properties=None)[source]

Initiates an upgrade.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
mode:
If set to Manual, WalkUpgradeDomain must be called to apply the update. If set to Auto, the Windows Azure platform will automatically apply the update To each upgrade domain for the service. Possible values are: Auto, Manual
package_url:
A URL that refers to the location of the service package in the Blob service. The service package can be located either in a storage account beneath the same subscription or a Shared Access Signature (SAS) URI from any storage account.
configuration:
The base-64 encoded service configuration file for the deployment.
label:
A name for the hosted service. The name can be up to 100 characters in length. It is recommended that the label be unique within the subscription. The name can be used to identify the hosted service for your tracking purposes.
force:
Specifies whether the rollback should proceed even when it will cause local data to be lost from some role instances. True if the rollback should proceed; otherwise false if the rollback should fail.
role_to_upgrade:
The name of the specific role to upgrade.
extended_properties:
Dictionary containing name/value pairs of storage account properties. You can have a maximum of 50 extended property name/value pairs. The maximum length of the Name element is 64 characters, only alphanumeric characters and underscores are valid in the Name, and the name must start with a letter. The value has a maximum length of 255 characters.
walk_upgrade_domain(service_name, deployment_name, upgrade_domain)[source]

Specifies the next upgrade domain to be walked during manual in-place upgrade or configuration change.

service_name:
Name of the hosted service.
deployment_name:
The name of the deployment.
upgrade_domain:
An integer value that identifies the upgrade domain to walk. Upgrade domains are identified with a zero-based index: the first upgrade domain has an ID of 0, the second has an ID of 1, and so on.