Upload
doandang
View
378
Download
7
Embed Size (px)
Citation preview
Azure SDK for Python DocumentationRelease 2.0.0 RC3
Microsoft
June 07, 2016
Contents
1 Installation: 1
2 DISCLAIMER 3
3 Documentation: 5
4 Features: 7
5 System Requirements: 9
6 Need Help?: 11
7 Contributing: 137.1 Contribute Code or Provide Feedback: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
8 Learn More 15
9 Indices and tables 179.1 Service Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179.2 Azure Active Directory Graph Rbac API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199.3 Resource Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209.4 Resource Management Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239.5 Content Delivery Network Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249.6 Apps Management (Web Apps, Logic Apps) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259.7 Storage Resource Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279.8 Compute and Network Resource Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299.9 Scheduler Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349.10 Redis Cache Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359.11 Notification Hubs Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369.12 Service Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379.13 azure package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399.14 azure.batch package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2609.15 azure.graphrbac package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3639.16 azure.mgmt.batch package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3779.17 azure.mgmt.cdn package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3909.18 azure.mgmt.logic package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4109.19 azure.mgmt.notificationhubs package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4309.20 azure.mgmt.redis package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4479.21 azure.mgmt.scheduler package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
i
9.22 azure.mgmt.web package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4729.23 azure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
Python Module Index 625
ii
CHAPTER 1
Installation:
The latest recommended release is currently a release candidate, tell this to pip to install it!
Use the --pre flag: pip install --pre azure
Specify the version: pip install azure==2.0.0rc3
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 2.0.0 RC3
2 Chapter 1. Installation:
CHAPTER 2
DISCLAIMER
This is a release candidate. It could have minor breaking changes until the stable release.
Some of the new generated libraries have not yet been tested extensively, and some have known issues (such as azure-mgmt-web).
Our goal is to release a stable version by the end of March 2016. Please send us your feedback!
3
Azure SDK for Python Documentation, Release 2.0.0 RC3
4 Chapter 2. DISCLAIMER
CHAPTER 3
Documentation:
Azure Resource Management
Authorization Resource Management (API)
Batch Management (API)
CDN Resource Management (API)
Compute Resource Management (API)
Apps
* Logic Apps Resource Management (API)
* Web Apps Management (API)
Network Resource Management (API)
Notification Hubs Resource Management (API)
Redis Cache Resource Management (API)
Resource Management (API)
Scheduler Management (API)
Storage Resource Management (API)
Batch (API)
Azure Active Directory Graph RBAC (API)
Service Management (API)
Service Bus (API)
Storage
All Documentation
5
http://azure-storage.readthedocs.org
Azure SDK for Python Documentation, Release 2.0.0 RC3
6 Chapter 3. Documentation:
CHAPTER 4
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
Batch Runtime
Manage Batch pools, jobs, task and job schedules
Azure Active Directory Graph RBAC API
Users
Applications
and more
Resource Management
Authorization: permissions, subscriptions, roles and more
Batch: manage Batch accounts and applications
CDN: profiles, endpoints creation and more
Compute: create virtual machines and more
Apps:
* Logic Apps: Workflow and job management
* Web Apps: App Service Plan, web sites, certificate, domains and more
Network: create virtual networks, network interfaces, public ips and more
Notification Hubs: Namespaces, hub creation/deletion and more
Redis: create cache and more
Resource:
* resources : create resource groups, register providers and more
* features : manage features of provider and more
* locks : manage resource group lock and more
7
https://github.com/Azure/azure-storage-pythonhttp://azure-storage.readthedocs.org
Azure SDK for Python Documentation, Release 2.0.0 RC3
* subscriptions : manage subscriptions and more
Scheduler: create job collections, create job 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
8 Chapter 4. Features:
CHAPTER 5
System Requirements:
The supported Python versions are 2.7.x, 3.3.x, 3.4.x, and 3.5.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.
9
https://www.python.org/download/http://aka.ms/python
Azure SDK for Python Documentation, Release 2.0.0 RC3
10 Chapter 5. System Requirements:
CHAPTER 6
Need Help?:
Be sure to check out the Microsoft Azure Developer Forums on Stack Overflow if you have trouble with the providedcode.
11
http://go.microsoft.com/fwlink/?LinkId=234489
Azure SDK for Python Documentation, Release 2.0.0 RC3
12 Chapter 6. Need Help?:
CHAPTER 7
Contributing:
7.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.
13
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 2.0.0 RC3
14 Chapter 7. Contributing:
CHAPTER 8
Learn More
Microsoft Azure Python Developer Center
15
http://azure.microsoft.com/en-us/develop/python/
Azure SDK for Python Documentation, Release 2.0.0 RC3
16 Chapter 8. Learn More
CHAPTER 9
Indices and tables
genindex
modindex
search
9.1 Service Bus
9.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
17
Azure SDK for Python Documentation, Release 2.0.0 RC3
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')
9.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(b'Hello World!')sbs.send_topic_message('taskdiscussion', msg)
Please consider that the message should be anything, not only readable data, then it has to be bytes in Python 3 andyou should have to manage your encoding yourself in Python 2.
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')
9.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:
18 Chapter 9. Indices and tables
Azure SDK for Python Documentation, Release 2.0.0 RC3
sbs.create_event_hub('myhub')
To send an event:
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.
9.2 Azure Active Directory Graph Rbac API
9.2.1 Create the client
The following code creates an instance of the 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 a Credentials instance.
You will also need the tenant id of the AD you want to manage. Could be the AD UUID or domain name. You canfollow this documentation to get it.
from azure.graphrbac import GraphRbacManagementClient, GraphRbacManagementClientConfiguration
# TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'# TODO: See above how to get a Credentials instancecredentials = ...tenant_id = "myad.onmicrosoft.com"
graphrbac_client = GraphRbacManagementClient(GraphRbacManagementClientConfiguration(
credentials,subscription_id,tenant_id
))
9.2.2 Manage users
The following code creates a user, get it directly and by list filtering, and then delete it. Filter syntax can be foundhere.
from azure.graphrbac.models import UserCreateParameters, UserCreateParametersPasswordProfile
user = graphrbac_client.user.create(UserCreateParameters(
user_principal_name="testbuddy@{}".format(MY_AD_DOMAIN),account_enabled=False,display_name='Test Buddy',mail_nickname='testbuddy',password_profile=UserCreateParametersPasswordProfile(
password='MyStr0ngP4ssword',force_change_password_next_login=True
))
)
9.2. Azure Active Directory Graph Rbac API 19
https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMappinghttps://msdn.microsoft.com/fr-fr/library/azure/ad/graph/howto/azure-ad-graph-api-operations-overview#TenantIdentifierhttps://msdn.microsoft.com/fr-fr/library/azure/ad/graph/howto/azure-ad-graph-api-operations-overview#TenantIdentifierhttps://msdn.microsoft.com/fr-fr/library/azure/ad/graph/howto/azure-ad-graph-api-supported-queries-filters-and-paging-options#-filterhttps://msdn.microsoft.com/fr-fr/library/azure/ad/graph/howto/azure-ad-graph-api-supported-queries-filters-and-paging-options#-filter
Azure SDK for Python Documentation, Release 2.0.0 RC3
# user is a User instanceself.assertEqual(user.display_name, 'Test Buddy')
user = graphrbac_client.user.get(user.object_id)self.assertEqual(user.display_name, 'Test Buddy')
for user in graphrbac_client.user.list(filter="displayName eq 'Test Buddy'"):self.assertEqual(user.display_name, 'Test Buddy')
graphrbac_client.user.delete(user.object_id)
9.3 Resource Management
9.3.1 Resource Management libraries
The ARM libraries are separated into several packages:
azure-mgmt-authorization
azure-mgmt-cdn
azure-mgmt-compute
azure-mgmt-logic
azure-mgmt-network
azure-mgmt-notificationhubs
azure-mgmt-redis
azure-mgmt-resource
azure-mgmt-scheduler
azure-mgmt-storage
azure-mgmt-web
The azure-mgmt-resource itself is splitted into several sub-librairies:
resources : manage resources groups, template, etc
features : manage features of provider
authorization : manage resource group lock
subscriptions : manage subscriptions
See the examples below for managing resource groups.
9.3.2 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.
20 Chapter 9. Indices and tables
Azure SDK for Python Documentation, Release 2.0.0 RC3
9.3.3 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 a Credential instance.
from azure.mgmt.resource.resources import ResourceManagementClient, ResourceManagementClientConfiguration
# TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'# TODO: See above how to get a Credentials instancecredentials = ...
resource_client = ResourceManagementClient(ResourceManagementClientConfiguration(
credentials,subscription_id
))
9.3.4 Create resource group
from azure.mgmt.resource.resources.models import ResourceGroup
group_name = 'mynewresourcegroup'result = resource_client.resource_groups.create_or_update(
group_name,ResourceGroup(
location='westus',tags={
'tag1': 'value1',},
))
9.3.5 List resource groups
resource_groups = resource_client.resource_groups.list()for group in resource_groups:
print(group.name)
9.3.6 Create resource
This creates an availability set using the generic resource API.
from azure.mgmt.resource.resources.models import GenericResource
resource_name = 'MyAvailabilitySet'
result = resource_client.resources.create_or_update(group_name,resource_provider_namespace="Microsoft.Compute",
9.3. Resource Management 21
https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping
Azure SDK for Python Documentation, Release 2.0.0 RC3
parent_resource_path="",resource_type="availabilitySets",resource_name=resource_name,api_version="2015-05-01-preview",parameters=GenericResource(
location='West US',properties={},
),)
9.3.7 Create deployment from linked template
This creates resources specified in a linked JSON template.
from azure.mgmt.resource.resources.models import Deploymentfrom azure.mgmt.resource.resources.models import DeploymentPropertiesfrom azure.mgmt.resource.resources.models import DeploymentModefrom azure.mgmt.resource.resources.models import ParametersLinkfrom azure.mgmt.resource.resources.models import TemplateLink
deployment_name = 'MyDeployment'
template = TemplateLink(uri='https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-create-availability-set/azuredeploy.json',
)
parameters = ParametersLink(uri='https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-create-availability-set/azuredeploy.parameters.json',
)
result = resource_client.deployments.create_or_update(group_name,deployment_name,properties=DeploymentProperties(
mode=DeploymentMode.incremental,template_link=template,parameters_link=parameters,
))
9.3.8 Create deployment from template
This creates resources specified in a JSON template.
from azure.mgmt.resource.resources.models import Deploymentfrom azure.mgmt.resource.resources.models import DeploymentPropertiesfrom azure.mgmt.resource.resources.models import DeploymentMode
deployment_name = 'MyDeployment'
template = {"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {"location": {
22 Chapter 9. Indices and tables
Azure SDK for Python Documentation, Release 2.0.0 RC3
"type": "string","allowedValues": [
"East US","West US","West Europe","East Asia","South East Asia"
],"metadata": {
"description": "Location to deploy to"}
}},"resources": [{
"type": "Microsoft.Compute/availabilitySets","name": "availabilitySet1","apiVersion": "2015-05-01-preview","location": "[parameters('location')]","properties": {}
}]
}
# Note: when specifying values for parameters, omit the outer elements $schema, contentVersion, parametersparameters = {"location": { "value": "West US"}}
result = resource_client.deployments.create_or_update(group_name,deployment_name,properties=DeploymentProperties(
mode=DeploymentMode.incremental,template=template,parameters=parameters,
))
9.3.9 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 hasnt been officially released yet. Theapplication has a pre-release of ADAL in its wheelhouse folder.
9.4 Resource Management Authentication
For general information on resource management, see Resource Management.
To be able to use use the ARM library, you need to obtain one of these instances:
azure.common.credentials.UserPassCredentials
azure.common.credentials.ServicePrincipalCredentials
And use it as credentials in your management configuration client. These two instances correspond to:
9.4. Resource Management Authentication 23
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 2.0.0 RC3
OAuth authentication using Azure Active Directory user/password
OAuth authentication using Active Directory application and service principal
9.4.1 Using Service Principal
There is now a detailled official tutorial to describe this: https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/
At this point, you must have:
Your client id. Found in the client id box in the Configure page of your application in the Azure portal
Your secret key. Generated when you have created the application. You cannot show the key after creation. Ifyouve lost the current key, you must create a new one in the Configure page of your application.
You AD tenant id. Its an UUID (e.g. ABCDEFGH-1234-ABCD-1234-ABCDEFGHIJKL) which point to theAD containing your application. You will found it in the URL when you are in the Azure portal in your AD, orin the view endpoints in any of the given url.
Then, you can create your credentials instance:
from azure.common.credentials import ServicePrincipalCredentials
credentials = ServicePrincipalCredentials(client_id = 'ABCDEFGH-1234-ABCD-1234-ABCDEFGHIJKL',secret = 'XXXXXXXXXXXXXXXXXXXXXXXX',tenant = 'ABCDEFGH-1234-ABCD-1234-ABCDEFGHIJKL'
)
9.4.2 Using AD User/Password
1. Connect to the Azure Classic Portal with your admin account
2. Create a user in your default AAD
You must NOT activate Multi-Factor Authentication
3. Go to Settings - Administrators
4. Click on Add and enter the email of the new user. Check the checkbox of the subscription you want to test withthis user.
5. Login to Azure Portal with this new user to change the temporary password to a new one. You will not be ableto use the temporary password for OAuth login.
You are now able to log in Python using OAuth.
from azure.common.credentials import UserPassCredentials
credentials = UserPassCredentials('[email protected]', # Your new user'my_smart_password', # Your password
)
9.5 Content Delivery Network Management
For general information on resource management, see Resource Management.
24 Chapter 9. Indices and tables
https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/https://azure.microsoft.com/en-us/documentation/articles/active-directory-create-users/
Azure SDK for Python Documentation, Release 2.0.0 RC3
9.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 a Credentials instance.
from azure.mgmt.cdn import CdnManagementClient, CdnManagementClientConfiguration
# TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'# TODO: See above how to get a Credentials instancecredentials = ...
cdn_client = CdnManagementClient(CdnManagementClientConfiguration(
credentials,subscription_id
))
9.5.2 Registration
Some operations in the ARM APIs require a one-time registration of the provider with your subscription.
Use the following code to do the registration. You can use the same credentials you created in the previous section.
from azure.mgmt.resource.resources import ResourceManagementClient, ResourceManagementClientConfiguration
resource_client = ResourceManagementClient(ResourceManagementClientConfiguration(
credentials,subscription_id
)resource_client.providers.register('Microsoft.Cdn')
9.5.3 Check name availability
The following code check the name availability of a end-point.
from azure.mgmt.cdn.models import CheckNameAvailabilityInput
output = self.cdn_client.name_availability.check_name_availability(name='myendpoint',type='Microsoft.Cdn/profiles/endpoints'
)# output is a CheckNameAvailabilityOutput instanceprint(output.name_available)
9.6 Apps Management (Web Apps, Logic Apps)
For general information on resource management, see Resource Management.
9.6. Apps Management (Web Apps, Logic Apps) 25
https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping
Azure SDK for Python Documentation, Release 2.0.0 RC3
9.6.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 a Credentials instance.
from azure.mgmt.logic import LogicManagementClient, LogicManagementClientConfigurationfrom azure.mgmt.web import WebSiteManagementClient, WebSiteManagementClientConfiguration
# TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'# TODO: See above how to get a Credentials instancecredentials = ...
logic_client = LogicManagementClient(LogicManagementClientConfiguration(
credentials,subscription_id
))web_client = WebSiteManagementClient(
WebSiteManagementClientConfiguration(credentials,subscription_id
))
9.6.2 Registration
Some operations in the ARM APIs require a one-time registration of the provider with your subscription.
Use the following code to do the registration. You can use the same credentials you created in the previous section.
from azure.mgmt.resource.resources import ResourceManagementClient, ResourceManagementClientConfiguration
resource_client = ResourceManagementClient(ResourceManagementClientConfiguration(
credentials,subscription_id
)resource_client.providers.register('Microsoft.Web')resource_client.providers.register('Microsoft.Logic')
9.6.3 Create an App Service Plan
The following code creates an App Service Plan under an existing resource group. To create or manage resourcegroups, see Resource Management.
from azure.mgmt.web.models import ServerFarmWithRichSku, SkuDescription
group_name = 'myresourcegroup'app_service_plan_name = 'myserviceplan'app_service_plan = web_client.server_farms.create_or_update_server_farm(
group_name,app_service_plan_name,
26 Chapter 9. Indices and tables
https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping
Azure SDK for Python Documentation, Release 2.0.0 RC3
ServerFarmWithRichSku(location='West US',sku = SkuDescription(
name='F1',tier='Free'
))
)# app_service_plan is a msrestazure.azure_operation.AzureOperationPoller instance# wait insure polling the underlying async operation until it's done.# result() will return a ServerFarmWithRichSku instanceapp_service_plan = app_service_plan.result()
9.6.4 Create a Logic App Workflow
The following code creates a logic app workflow under an existing app service plan.
from azure.mgmt.logic.models import Workflow, Sku, ResourceReference
group_name = 'myresourcegroup'workflow_name = '12HourHeartBeat'logic_client.workflows.create_or_update(
group_name,workflow_name,Workflow(
location = 'West US',sku = Sku(
name = 'Free',plan = ResourceReference(
id = app_service_plan.id)
),definition={
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2015-08-01-preview/workflowdefinition.json#","contentVersion": "1.0.0.0","parameters": {},"triggers": {},"actions": {},"outputs": {}
})
)
9.7 Storage Resource Management
For general information on resource management, see Resource Management.
9.7.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 a Credentials instance.
9.7. Storage Resource Management 27
https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping
Azure SDK for Python Documentation, Release 2.0.0 RC3
from azure.mgmt.storage import StorageManagementClient, StorageManagementClientConfiguration
# TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'# TODO: See above how to get a Credentials instancecredentials = ...
storage_client = StorageManagementClient(StorageManagementClientConfiguration(
credentials,subscription_id
))
9.7.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.resources import ResourceManagementClient, ResourceManagementClientConfiguration
resource_client = ResourceManagementClient(ResourceManagementClientConfiguration(
credentials,subscription_id
)resource_client.providers.register('Microsoft.Storage')
9.7.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.models 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,
),)# result is a msrestazure.azure_operation.AzureOperationPoller instance# wait insure polling the underlying async operation until it's done.result.wait()
28 Chapter 9. Indices and tables
Azure SDK for Python Documentation, Release 2.0.0 RC3
9.7.4 List storage accounts
group_name = 'myresourcegroup'storage_accounts = storage_client.storage_accounts.list_by_resource_group(group_name)for storage_account in storage_accounts:
print(storage_account.name)print(storage_account.account_type)print(storage_account.location)print(storage_account.provisioning_state)print('')
9.7.5 Get storage account keys
group_name = 'myresourcegroup'account_name = 'mystorageaccountname'storage_account_keys = storage_client.storage_accounts.list_keys(group_name, account_name)print(storage_account_keys.key1)print(storage_account_keys.key2)
9.8 Compute and Network Resource Management
For general information on resource management, see Resource Management.
9.8.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 a Credentials instance.
from azure.mgmt.compute import ComputeManagementClient, ComputeManagementClientConfigurationfrom azure.mgmt.network import NetworkManagementClient, NetworkManagementClientConfiguration
# TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'# TODO: See above how to get a Credentials instancecredentials = ...
compute_client = ComputeManagementClient(ComputeManagementClientConfiguration(
credentials,subscription_id
))
network_client = NetworkManagementClient(NetworkManagementClientConfiguration(
credentials,subscription_id
))
9.8. Compute and Network Resource Management 29
https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping
Azure SDK for Python Documentation, Release 2.0.0 RC3
9.8.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.
from azure.mgmt.resource.resources import ResourceManagementClient, ResourceManagementClientConfiguration
resource_client = ResourceManagementClient(ResourceManagementClientConfiguration(
credentials,subscription_id
)resource_client.providers.register('Microsoft.Compute')resource_client.providers.register('Microsoft.Network')
9.8.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(region,
)
for publisher in result_list_pub:result_list_offers = compute_client.virtual_machine_images.list_offers(
region,publisher.name,
)
for offer in result_list_offers:result_list_skus = compute_client.virtual_machine_images.list_skus(
region,publisher.name,offer.name,
)
for sku in result_list_skus:result_list = compute_client.virtual_machine_images.list(
region,publisher.name,offer.name,sku.name,
)
for version in result_list:result_get = compute_client.virtual_machine_images.get(
region,publisher.name,offer.name,sku.name,version.name,
)
30 Chapter 9. Indices and tables
Azure SDK for Python Documentation, Release 2.0.0 RC3
print('PUBLISHER: {0}, OFFER: {1}, SKU: {2}, VERSION: {3}'.format(publisher.name,offer.name,sku.name,version.name,
))
9.8.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.
import azure.mgmt.computeimport azure.mgmt.networkimport azure.mgmt.resourceimport azure.mgmt.storage
resource_client = azure.mgmt.resource.ResourceManagementClient(res_config)storage_client = azure.mgmt.storage.StorageManagementClient(storage_config)compute_client = azure.mgmt.compute.ComputeManagementClient(compute_config)network_client = azure.mgmt.network.NetworkResourceProviderClient(network_config)
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.models.ResourceGroup(
location=REGION,),
)
# 2. Create a storage accountresult = storage_client.storage_accounts.create(
GROUP_NAME,STORAGE_NAME,
9.8. Compute and Network Resource Management 31
Azure SDK for Python Documentation, Release 2.0.0 RC3
azure.mgmt.storage.models.StorageAccountCreateParameters(location=REGION,account_type=azure.mgmt.storage.models.AccountType.standard_lrs,
),)result.wait() # async operation
# 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,
)
# 4. Create the virtual machineresult = compute_client.virtual_machines.create_or_update(
GROUP_NAME,VM_NAME,azure.mgmt.compute.models.VirtualMachine(
location=REGION,os_profile=azure.mgmt.compute.models.OSProfile(
admin_username=ADMIN_USERNAME,admin_password=ADMIN_PASSWORD,computer_name=COMPUTER_NAME,
),hardware_profile=azure.mgmt.compute.models.HardwareProfile(
virtual_machine_size=azure.mgmt.compute.models.VirtualMachineSizeTypes.standard_a0),network_profile=azure.mgmt.compute.models.NetworkProfile(
network_interfaces=[azure.mgmt.compute.models.NetworkInterfaceReference(
reference_uri=nic_id,),
],),storage_profile=azure.mgmt.compute.models.StorageProfile(
os_disk=azure.mgmt.compute.models.OSDisk(caching=azure.mgmt.compute.models.CachingTypes.none,create_option=azure.mgmt.compute.models.DiskCreateOptionTypes.from_image,name=OS_DISK_NAME,vhd=azure.mgmt.compute.models.VirtualHardDisk(
uri='https://{0}.blob.core.windows.net/vhds/{1}.vhd'.format(STORAGE_NAME,OS_DISK_NAME,
),),
),image_reference = azure.mgmt.compute.models.ImageReference(
publisher=IMAGE_PUBLISHER,offer=IMAGE_OFFER,sku=IMAGE_SKU,version=IMAGE_VERSION,
),),
32 Chapter 9. Indices and tables
Azure SDK for Python Documentation, Release 2.0.0 RC3
),)
# Display the public ip address# You can now connect to the machine using SSHpublic_ip_address = network_client.public_ip_addresses.get(GROUP_NAME, PUBLIC_IP_NAME)print('VM available at {}'.format(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.models.VirtualNetwork(
location=region,address_space=azure.mgmt.network.models.AddressSpace(
address_prefixes=['10.1.0.0/16',
],),subnets=[
azure.mgmt.network.models.Subnet(name=subnet_name,address_prefix='10.1.0.0/24',
),],
),)
subnet = network_client.subnets.get(group_name, network_name, subnet_name)
result = network_client.public_ip_addresses.create_or_update(group_name,ip_name,azure.mgmt.network.models.PublicIPAddress(
location=region,public_ip_allocation_method=azure.mgmt.network.models.IPAllocationMethod.dynamic,idle_timeout_in_minutes=4,
),)
public_ip_address = network_client.public_ip_addresses.get(group_name, ip_name)public_ip_id = public_ip_address.id
result = network_client.network_interfaces.create_or_update(group_name,interface_name,azure.mgmt.network.models.NetworkInterface(
location=region,ip_configurations=[
azure.mgmt.network.models.NetworkInterfaceIPConfiguration(name='default',private_ip_allocation_method=azure.mgmt.network.models.IPAllocationMethod.dynamic,subnet=subnet,public_ip_address=azure.mgmt.network.models.ResourceId(
9.8. Compute and Network Resource Management 33
Azure SDK for Python Documentation, Release 2.0.0 RC3
id=public_ip_id,),
),],
),)
network_interface = network_client.network_interfaces.get(group_name,interface_name,
)
return network_interface.id
9.9 Scheduler Management
For general information on resource management, see Resource Management.
9.9.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 a Credentials instance.
from azure.mgmt.scheduler import SchedulerManagementClient, SchedulerManagementClientConfiguration
# TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'# TODO: See above how to get a Credentials instancecredentials = ...
scheduler_client = SchedulerManagementClient(SchedulerManagementClientConfiguration(
credentials,subscription_id
))
9.9.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.resources import ResourceManagementClient, ResourceManagementClientConfiguration
resource_client = ResourceManagementClient(ResourceManagementClientConfiguration(
credentials,subscription_id
34 Chapter 9. Indices and tables
https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping
Azure SDK for Python Documentation, Release 2.0.0 RC3
)resource_client.providers.register('Microsoft.Scheduler')
9.9.3 Create a job collection
The following code creates a job collection under an existing resource group. To create or manage resource groups,see Resource Management.
from azure.mgmt.scheduler.models import JobCollectionDefinition, JobCollectionProperties, Sku
group_name = 'myresourcegroup'job_collection_name = "myjobcollection"scheduler_client.job_collections.create_or_update(
group_name,job_collection_name,JobCollectionDefinition(
location = "West US",properties = JobCollectionProperties(
sku = Sku(name="Free"
))
))# scheduler_client is a JobCollectionDefinition instance
9.10 Redis Cache Management
For general information on resource management, see Resource Management.
9.10.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 a Credentials instance.
from azure.mgmt.redis import RedisManagementClient, RedisManagementClientConfiguration
# TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'# TODO: See above how to get a Credentials instancecredentials = ...
redis_client = RedisManagementClient(RedisManagementClientConfiguration(
credentials,subscription_id
))
9.10. Redis Cache Management 35
https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping
Azure SDK for Python Documentation, Release 2.0.0 RC3
9.10.2 Registration
Some operations in the ARM APIs require a one-time registration of the provider with your subscription.
Use the following code to do the registration. You can use the same credentials you created in the previous section.
from azure.mgmt.resource.resources import ResourceManagementClient, ResourceManagementClientConfiguration
resource_client = ResourceManagementClient(ResourceManagementClientConfiguration(
credentials,subscription_id
)resource_client.providers.register('Microsoft.Cache')
9.10.3 Create Redis Cache
The following code creates a new redis cache under an existing resource group. To create or manage resource groups,see Resource Management.
from azure.mgmt.redis.models import Sku, RedisCreateOrUpdateParameters
group_name = 'myresourcegroup'cache_name = 'mycachename'redis_cache = redis_client.redis.create_or_update(
group_name,cache_name,RedisCreateOrUpdateParameters(
sku = Sku(name = 'Basic', family = 'C', capacity = '1'),location = "West US"
))# redis_cache is a RedisResourceWithAccessKey instance
9.11 Notification Hubs Management
For general information on resource management, see Resource Management.
9.11.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 a Credentials instance.
from azure.mgmt.notificationhubs import NotificationHubsManagementClient, NotificationHubsManagementClientConfiguration
# TODO: Replace this with your subscription idsubscription_id = '33333333-3333-3333-3333-333333333333'# TODO: See above how to get a Credentials instancecredentials = ...
redis_client = NotificationHubsManagementClient(NotificationHubsManagementClientConfiguration(
36 Chapter 9. Indices and tables
https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping
Azure SDK for Python Documentation, Release 2.0.0 RC3
credentials,subscription_id
))
9.11.2 Registration
Some operations in the ARM APIs require a one-time registration of the provider with your subscription.
Use the following code to do the registration. You can use the same credentials you created in the previous section.
from azure.mgmt.resource.resources import ResourceManagementClient, ResourceManagementClientConfiguration
resource_client = ResourceManagementClient(ResourceManagementClientConfiguration(
credentials,subscription_id
)resource_client.providers.register('Microsoft.NotificationHubs')
9.11.3 Check namespace availability
The following code check namespace availability of a notification hub.
from azure.mgmt.notificationhubs.models import CheckAvailabilityParameters
account_name = 'mynotificationhub'output = notificationhubs_client.namespaces.check_availability(
azure.mgmt.notificationhubs.models.CheckAvailabilityParameters(name = account_name
))# output is a CheckAvailibilityResource instanceprint(output.is_availiable) # Yes, it's 'availiable', it's a typo in the REST API
9.12 Service Management
9.12.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 wont need to upload one.
To do this, download your publish settings then use this code to create the .pem file.
9.12. Service Management 37
http://go.microsoft.com/fwlink/?LinkID=301775
Azure SDK for Python Documentation, Release 2.0.0 RC3
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)
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)
38 Chapter 9. Indices and tables
http://www.openssl.orghttp://manage.windows.com
Azure SDK for Python Documentation, Release 2.0.0 RC3
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)
9.13 azure package
9.13.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
9.13. azure package 39
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 2.0.0 RC3
exception azure.common.AzureMissingResourceHttpError(message, status_code)Bases: azure.common.AzureHttpError
azure.mgmt package
Subpackages
azure.mgmt.authorization package
Submodules
azure.mgmt.authorization.models moduleclass azure.mgmt.authorization.models.RoleAssignmentFilter(principal_id=None)
Bases: msrest.serialization.Model
Role Assignments filter
Parameters principal_id (str) Returns role assignment of the specific principal.class azure.mgmt.authorization.models.RoleDefinitionFilter(role_name=None)
Bases: msrest.serialization.Model
Role Definitions filter
Parameters role_name (str) Returns role definition with the specific name.
class azure.mgmt.authorization.models.ClassicAdministratorProperties(email_address=None,role=None)
Bases: msrest.serialization.Model
Classic Administrator properties.
Parameters
email_address (str) Gets or sets the email address
role (str) Gets or sets the role
class azure.mgmt.authorization.models.ClassicAdministrator(id=None, name=None,type=None, proper-ties=None)
Bases: msrest.serialization.Model
Classic Administrators
Parameters
id (str) Gets or sets the classic administrator id.
name (str) Gets or sets the classic administrator name.
type (str) Gets or sets the classic administrator type.
properties (ClassicAdministratorProperties) Gets or sets the classic ad-ministrator properties.
class azure.mgmt.authorization.models.Permission(actions=None, not_actions=None)Bases: msrest.serialization.Model
Role definition permissions.
Parameters
40 Chapter 9. Indices and tables
http://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Model
Azure SDK for Python Documentation, Release 2.0.0 RC3
actions (list of str) Role definition allowed actions.
not_actions (list of str) Role definition denied actions.
class azure.mgmt.authorization.models.ProviderOperation(name=None, dis-play_name=None, descrip-tion=None, origin=None,properties=None)
Bases: msrest.serialization.Model
Operation
Parameters
name (str) Gets or sets the operation name
display_name (str) Gets or sets the operation display name
description (str) Gets or sets the operation description
origin (str) Gets or sets the operation origin
properties (object) Gets or sets the operation properties
class azure.mgmt.authorization.models.ResourceType(name=None, display_name=None,operations=None)
Bases: msrest.serialization.Model
Resource Type
Parameters
name (str) Gets or sets the resource type name
display_name (str) Gets or sets the resource type display name
operations (list of ProviderOperation) Gets or sets the resource type operations
class azure.mgmt.authorization.models.ProviderOperationsMetadata(id=None,name=None,type=None, dis-play_name=None,re-source_types=None,opera-tions=None)
Bases: msrest.serialization.Model
Provider Operations metadata
Parameters
id (str) Gets or sets the provider id.
name (str) Gets or sets the provider name
type (str) Gets or sets the provider type
display_name (str) Gets or sets the provider display name
resource_types (list of ResourceType) Gets or sets the provider resource types
operations (list of ProviderOperation) Gets or sets the provider operations
9.13. azure package 41
http://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/functions.html#objecthttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#str
Azure SDK for Python Documentation, Release 2.0.0 RC3
class azure.mgmt.authorization.models.RoleAssignmentPropertiesWithScope(scope=None,role_definition_id=None,prin-ci-pal_id=None)
Bases: msrest.serialization.Model
Role assignment properties with scope.
Parameters
scope (str) Gets or sets role assignment scope.
role_definition_id (str) Gets or sets role definition id.
principal_id (str) Gets or sets principal Id.
class azure.mgmt.authorization.models.RoleAssignment(id=None, name=None,type=None, properties=None)
Bases: msrest.serialization.Model
Role Assignments
Parameters
id (str) Gets or sets role assignment id.
name (str) Gets or sets role assignment name.
type (str) Gets or sets role assignment type.
properties (RoleAssignmentPropertiesWithScope) Gets or sets role as-signment properties.
class azure.mgmt.authorization.models.RoleAssignmentProperties(role_definition_id=None,princi-pal_id=None)
Bases: msrest.serialization.Model
Role assignment properties.
Parameters
role_definition_id (str) Gets or sets role definition id.
principal_id (str) Gets or sets principal Id.
class azure.mgmt.authorization.models.RoleAssignmentCreateParameters(properties=None)Bases: msrest.serialization.Model
Role assignment create parameters.
Parameters properties (RoleAssignmentProperties) Gets or sets role assignmentproperties.
class azure.mgmt.authorization.models.RoleDefinitionProperties(role_name=None,description=None,type=None, per-missions=None,assignable_scopes=None)
Bases: msrest.serialization.Model
Role definition properties.
Parameters
role_name (str) Gets or sets role name.
42 Chapter 9. Indices and tables
http://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#str
Azure SDK for Python Documentation, Release 2.0.0 RC3
description (str) Gets or sets role definition description.
type (str) Gets or sets role type.
permissions (list of Permission) Gets or sets role definition permissions.
assignable_scopes (list of str) Gets or sets role definition assignable scopes.
class azure.mgmt.authorization.models.RoleDefinition(id=None, name=None,type=None, properties=None)
Bases: msrest.serialization.Model
Role definition.
Parameters
id (str) Gets or sets role definition id.
name (str) Gets or sets role definition name.
type (str) Gets or sets role definition type.
properties (RoleDefinitionProperties) Gets or sets role definition proper-ties.
class azure.mgmt.authorization.models.ClassicAdministratorPaged(*args, **kwargs)Bases: msrest.paging.Paged
A paging container for iterating over a list of ClassicAdministrator object
class azure.mgmt.authorization.models.PermissionPaged(*args, **kwargs)Bases: msrest.paging.Paged
A paging container for iterating over a list of Permission object
class azure.mgmt.authorization.models.ProviderOperationsMetadataPaged(*args,**kwargs)
Bases: msrest.paging.Paged
A paging container for iterating over a list of ProviderOperationsMetadata object
class azure.mgmt.authorization.models.RoleAssignmentPaged(*args, **kwargs)Bases: msrest.paging.Paged
A paging container for iterating over a list of RoleAssignment object
class azure.mgmt.authorization.models.RoleDefinitionPaged(*args, **kwargs)Bases: msrest.paging.Paged
A paging container for iterating over a list of RoleDefinition object
azure.mgmt.authorization.operations moduleclass azure.mgmt.authorization.operations.ClassicAdministratorsOperations(client,
con-fig,se-ri-al-izer,de-se-ri-al-izer)
9.13. azure package 43
https://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.paging.Pagedhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.paging.Pagedhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.paging.Pagedhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.paging.Pagedhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.paging.Paged
Azure SDK for Python Documentation, Release 2.0.0 RC3
Bases: object
ClassicAdministratorsOperations operations.
Parameters
client Client for service requests.
config Configuration of service client.
serializer An object model serializer.
deserializer An objec model deserializer.
list(api_version, custom_headers={}, raw=False, **operation_config)Gets a list of classic administrators for the subscription.
Parameters
api_version (str)
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type ClassicAdministratorPagedclass azure.mgmt.authorization.operations.PermissionsOperations(client, config, se-
rializer, deserial-izer)
Bases: object
PermissionsOperations operations.
Parameters
client Client for service requests.
config Configuration of service client.
serializer An object model serializer.
deserializer An objec model deserializer.
list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path,resource_type, resource_name, custom_headers={}, raw=False, **opera-tion_config)
Gets a resource permissions.
Parameters
resource_group_name (str) The name of the resource group. The name is caseinsensitive.
resource_provider_namespace (str) Resource
parent_resource_path (str) Resource
resource_type (str) Resource
resource_name (str) Resource
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
44 Chapter 9. Indices and tables
https://docs.python.org/3.5/library/functions.html#objecthttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttps://docs.python.org/3.5/library/functions.html#objecthttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#bool
Azure SDK for Python Documentation, Release 2.0.0 RC3
Return type PermissionPaged
list_for_resource_group(resource_group_name, custom_headers={}, raw=False, **opera-tion_config)
Gets a resource group permissions.
Parameters
resource_group_name (str) Name of the resource group to get the permissionsfor.The name is case insensitive.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type PermissionPaged
class azure.mgmt.authorization.operations.ProviderOperationsMetadataOperations(client,con-fig,se-ri-al-izer,de-se-ri-al-izer)
Bases: object
ProviderOperationsMetadataOperations operations.
Parameters
client Client for service requests.
config Configuration of service client.
serializer An object model serializer.
deserializer An objec model deserializer.
get(resource_provider_namespace, api_version, expand=resourceTypes, custom_headers={},raw=False, **operation_config)Gets provider operations metadata
Parameters
resource_provider_namespace (str) Namespace of the resource provider.
api_version (str)
expand (str)
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type ProviderOperationsMetadata
Return type ClientRawResponse if raw=true
9.13. azure package 45
https://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttps://docs.python.org/3.5/library/functions.html#objecthttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponse
Azure SDK for Python Documentation, Release 2.0.0 RC3
list(api_version, expand=resourceTypes, custom_headers={}, raw=False, **operation_config)Gets provider operations metadata list
Parameters
api_version (str)
expand (str)
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type ProviderOperationsMetadataPaged
class azure.mgmt.authorization.operations.RoleAssignmentsOperations(client,config,serializer,deserial-izer)
Bases: object
RoleAssignmentsOperations operations.
Parameters
client Client for service requests.
config Configuration of service client.
serializer An object model serializer.
deserializer An objec model deserializer.
create(scope, role_assignment_name, properties=None, custom_headers={}, raw=False, **opera-tion_config)
Create role assignment.
Parameters
scope (str) Scope.
role_assignment_name (str) Role assignment name.
properties (RoleAssignmentProperties) Gets or sets role assignment prop-erties.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleAssignment
Return type ClientRawResponse if raw=true
create_by_id(role_assignment_id, properties=None, custom_headers={}, raw=False, **opera-tion_config)
Create role assignment by Id.
Parameters
role_assignment_id (str) Role assignment Id
properties (RoleAssignmentProperties) Gets or sets role assignment prop-erties.
46 Chapter 9. Indices and tables
https://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttps://docs.python.org/3.5/library/functions.html#objecthttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponsehttps://docs.python.org/3.5/library/stdtypes.html#str
Azure SDK for Python Documentation, Release 2.0.0 RC3
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleAssignment
Return type ClientRawResponse if raw=true
delete(scope, role_assignment_name, custom_headers={}, raw=False, **operation_config)Delete role assignment.
Parameters
scope (str) Scope.
role_assignment_name (str) Role assignment name.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleAssignment
Return type ClientRawResponse if raw=true
delete_by_id(role_assignment_id, custom_headers={}, raw=False, **operation_config)Delete role assignment.
Parameters
role_assignment_id (str) Role assignment Id
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleAssignment
Return type ClientRawResponse if raw=true
get(scope, role_assignment_name, custom_headers={}, raw=False, **operation_config)Get single role assignment.
Parameters
scope (str) Scope.
role_assignment_name (str) Role assignment name.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleAssignment
Return type ClientRawResponse if raw=true
get_by_id(role_assignment_id, custom_headers={}, raw=False, **operation_config)Get single role assignment.
Parameters
9.13. azure package 47
https://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponsehttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponsehttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponsehttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponse
Azure SDK for Python Documentation, Release 2.0.0 RC3
role_assignment_id (str) Role assignment Id
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleAssignment
Return type ClientRawResponse if raw=true
list(filter=None, custom_headers={}, raw=False, **operation_config)Gets role assignments of the subscription.
Parameters
filter (str) The filter to apply on the operation.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleAssignmentPaged
list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path,resource_type, resource_name, filter=None, custom_headers={}, raw=False,**operation_config)
Gets role assignments of the resource.
Parameters
resource_group_name (str) The name of the resource group.
resource_provider_namespace (str) Resource identity.
parent_resource_path (str) Resource identity.
resource_type (str) Resource identity.
resource_name (str) Resource identity.
filter (str) The filter to apply on the operation.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleAssignmentPaged
list_for_resource_group(resource_group_name, filter=None, custom_headers={}, raw=False,**operation_config)
Gets role assignments of the resource group.
Parameters
resource_group_name (str) Resource group name.
filter (str) The filter to apply on the operation.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
48 Chapter 9. Indices and tables
https://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponsehttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#bool
Azure SDK for Python Documentation, Release 2.0.0 RC3
Return type RoleAssignmentPaged
list_for_scope(scope, filter=None, custom_headers={}, raw=False, **operation_config)Gets role assignments of the scope.
Parameters
scope (str) Scope.
filter (str) The filter to apply on the operation.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleAssignmentPaged
class azure.mgmt.authorization.operations.RoleDefinitionsOperations(client,config,serializer,deserial-izer)
Bases: object
RoleDefinitionsOperations operations.
Parameters
client Client for service requests.
config Configuration of service client.
serializer An object model serializer.
deserializer An objec model deserializer.
create_or_update(scope, role_definition_id, role_definition, custom_headers={}, raw=False,**operation_config)
Creates or updates a role definition.
Parameters
scope (str) Scope
role_definition_id (str) Role definition id.
role_definition (RoleDefinition) Role definition.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleDefinition
Return type ClientRawResponse if raw=true
delete(scope, role_definition_id, custom_headers={}, raw=False, **operation_config)Deletes the role definition.
Parameters
scope (str) Scope
role_definition_id (str) Role definition id.
9.13. azure package 49
https://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttps://docs.python.org/3.5/library/functions.html#objecthttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponsehttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#str
Azure SDK for Python Documentation, Release 2.0.0 RC3
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleDefinition
Return type ClientRawResponse if raw=true
get(scope, role_definition_id, custom_headers={}, raw=False, **operation_config)Get role definition by name (GUID).
Parameters
scope (str) Scope
role_definition_id (str) Role definition Id
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleDefinition
Return type ClientRawResponse if raw=true
get_by_id(role_definition_id, custom_headers={}, raw=False, **operation_config)Get role definition by name (GUID).
Parameters
role_definition_id (str) Fully qualified role definition Id
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleDefinition
Return type ClientRawResponse if raw=true
list(scope, filter=None, custom_headers={}, raw=False, **operation_config)Get all role definitions that are applicable at scope and above. Use atScopeAndBelow filter to search belowthe given scope as well
Parameters
scope (str) Scope
filter (str) The filter to apply on the operation.
custom_headers (dict) headers that will be added to the request
raw (bool) returns the direct response alongside the deserialized response
operation_config Operation configuration overrides.
Return type RoleDefinitionPaged
50 Chapter 9. Indices and tables
https://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponsehttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponsehttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#boolhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.pipeline.ClientRawResponsehttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#bool
Azure SDK for Python Documentation, Release 2.0.0 RC3
Module contentsclass azure.mgmt.authorization.AuthorizationManagementClient(config)
Bases: object
Parameters config (AuthorizationManagementClientConfiguration) Configu-ration for client.
Variables
classic_administrators (operations.ClassicAdministratorsOperations) ClassicAdministrators operations
permissions (operations.PermissionsOperations) Permissions opera-tions
provider_operations_metadata (operations.ProviderOperationsMetadataOperations) ProviderOperationsMetadata operations
role_assignments (operations.RoleAssignmentsOperations) RoleAs-signments operations
role_definitions (operations.RoleDefinitionsOperations) RoleDefinitions operations
class azure.mgmt.authorization.AuthorizationManagementClientConfiguration(credentials,sub-scrip-tion_id,api_version=2015-07-01,accept_language=en-US,long_running_operation_retry_timeout=30,gen-er-ate_client_request_id=True,base_url=None,filepath=None)
Bases: msrestazure.azure_configuration.AzureConfiguration
Configuration for AuthorizationManagementClient Note that all parameters used to create this instance are savedas instance attributes.
Parameters
credentials (A msrestazure Credentials object) Gets Azure subscrip-tion credentials.
subscription_id (str) Gets subscription credentials which uniquely identify Mi-crosoft Azure subscription. The subscription ID forms part of the URI for every servicecall.
api_version (str) Client Api Version.
accept_language (str) Gets or sets the preferred language for the response.
long_running_operation_retry_timeout (int) Gets or sets the retry timeoutin seconds for Long Running Operations. Default value is 30.
generate_client_request_id (bool) When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
9.13. azure package 51
https://docs.python.org/3.5/library/functions.html#objecthttp://msrestazure.readthedocs.org/en/latest/msrestazure.html#msrestazure.azure_configuration.AzureConfigurationhttp://msrestazure.readthedocs.org/en/latest/msrestazure.html#module-msrestazure.azure_active_directoryhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/functions.html#inthttps://docs.python.org/3.5/library/functions.html#bool
Azure SDK for Python Documentation, Release 2.0.0 RC3
base_url (str) Service URL
filepath (str) Existing config
azure.mgmt.compute package
Submodules
azure.mgmt.compute.models moduleclass azure.mgmt.compute.models.InstanceViewStatus(code=None, level=None, dis-
play_status=None, message=None,time=None)
Bases: msrest.serialization.Model
Instance view status.
Parameters
code (str) Gets the status Code.
level (str) Gets or sets the level Code. Possible values include: Info, Warning,Error
display_status (str) Gets or sets the short localizable label for the status.
message (str) Gets or sets the detailed Message, including for alerts and error mes-sages.
time (datetime) Gets or sets the time of the status.class azure.mgmt.compute.models.SubResource(id=None)
Bases: msrest.serialization.Model
Parameters id (str) Resource Id
class azure.mgmt.compute.models.AvailabilitySet(location, tags=None, plat-form_update_domain_count=None,platform_fault_domain_count=None,virtual_machines=None, statuses=None)
Bases: azure.mgmt.compute.models.resource.Resource
Create or update Availability Set parameters.
Variables are only populated by the server, and will be ignored when sending a request.
Variables
id (str) Resource Id
name (str) Resource name
type (str) Resource type
Parameters
location (str) Resource location
tags (dict) Resource tags
platform_update_domain_count (int) Gets or sets Update Domain count.
platform_fault_domain_count (int) Gets or sets Fault Domain count.
virtual_machines (list of SubResource) Gets or sets a list containing referenceto all Virtual Machines created under this Availability Set.
52 Chapter 9. Indices and tables
https://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/datetime.html#module-datetimehttp://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/functions.html#idhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/functions.html#typehttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/stdtypes.html#dicthttps://docs.python.org/3.5/library/functions.html#inthttps://docs.python.org/3.5/library/functions.html#int
Azure SDK for Python Documentation, Release 2.0.0 RC3
statuses (list of InstanceViewStatus) Gets or sets the resource status informa-tion.
class azure.mgmt.compute.models.VirtualMachineSize(name=None, num-ber_of_cores=None,os_disk_size_in_mb=None, re-source_disk_size_in_mb=None,memory_in_mb=None,max_data_disk_count=None)
Bases: msrest.serialization.Model
Describes the properties of a VM size.
Parameters
name (str) Gets or sets the VM size name.
number_of_cores (int) Gets or sets the Number of cores supported by a VM size.
os_disk_size_in_mb (int) Gets or sets the OS disk size allowed by a VM size.
resource_disk_size_in_mb (int) Gets or sets the Resource disk size allowed bya VM size.
memory_in_mb (int) Gets or sets the Memory size supported by a VM size.
max_data_disk_count (int) Gets or sets the Maximum number of data disks al-lowed by a VM size.
class azure.mgmt.compute.models.VirtualMachineExtensionImage(location, operat-ing_system, com-pute_role, han-dler_schema,tags=None,vm_scale_set_enabled=None,sup-ports_multiple_extensions=None)
Bases: azure.mgmt.compute.models.resource.Resource
Describes a Virtual Machine Extension Image.
Variables are only populated by the server, and will be ignored when sending a request.
Variables
id (str) Resource Id
name (str) Resource name
type (str) Resource type
Parameters
location (str) Resource location
tags (dict) Resource tags
operating_system (str) Gets or sets the operating system this extension supports.
compute_role (str) Gets or sets the type of role (IaaS or PaaS) this extension sup-ports.
handler_schema (str) Gets or sets the schema defined by publisher, where extensionconsumers should provide settings in a matching schema.
9.13. azure package 53
http://msrest.readthedocs.org/en/latest/msrest.html#msrest.serialization.Modelhttps://docs.python.org/3.5/library/stdtypes.html#strhttps://docs.python.org/3.5/library/functions.html#inthttps://docs.python.org/3.5/library/functions.html#inthttps://docs.python.org/3.5/library/functions.html#inthttps://docs.python.org/3.5/library/functions.html#inthttps://docs.python.org/3.5/library/functions.html#inthttps://docs.python.org/3.5/library/functions.html#idhttps://docs.python.org/3.5/library/std