Skip to content

Migrate from 1.0.x 0.20.0 to 2.0.0 0.30.0

Laurent Mazuel edited this page Aug 5, 2016 · 3 revisions

The 1.0.0 version contains a preview version of the ARM library. Since the 2.0.0 is based on a new code generator, there are a few modifications to consider.

This article is for management only, if you used the following packages in their 0.20.0 versions:

  • azure-mgmt-resource
  • azure-mgmt-compute
  • azure-mgmt-network
  • azure-mgmt-storage

Authentication

azure.mgmt.common.SubscriptionCloudCredentials is replaced by two classes:

  • azure.common.credentials.UserPassCredentials
  • azure.common.credentials.ServicePrincipalCredentials

Class creation

For instance, for the compute service, replace this:

service = ComputeManagementClient(credentials)

by

service = ComputeManagementClient(
    credentials,
    subscription_id
) 

Async operation

Many async operations now return a msrestazure.azure_operation.AzureOperationPoller. This class has a wait function which tests for you the state of the operation and returns until it's finished. There is also a result function which waits and returns the instance object. As a direct consequence, status and provisioning_state are no longer available.

Renaming

Exceptions

azure.common.AzureHttpError -> azure.common.exceptions.CloudError

Attribute of clients

client.credentials.subscription_id -> client.config.subscription_id client.long_running_operation_initial_timeout -> client.config.long_running_operation_timeout

Models

  • Models are now in subpackage models.
  • All the Ip part in a class name (e.g. IpAddress) are now uppercase (e.g. IPAddress)
  • OSDisk.virtual_hard_disk -> OSDisk.vhd
  • GenericResourceExtended.name -> GenericResourceExtended.resource_type
  • When you create a deployment fron a template, the template has to be given as a dict object instead of a string

Logging

If you need the log of the lower level libraries (HTTP requests, etc.), you can configure the 'msrest' logger.

Clone this wiki locally