I am trying to call a specific version of the ARM API:
2017-03-01-preview
In a normal REST API call, you would be able to specify api-version=2017-03-01-preview
, however I see no similar option using the Azure Python SDK.
Specifically trying to create a new Monitor Client against this API version. http://azure-sdk-for-python.readthedocs.io/en/latest/sample_azure-monitor.html
Thanks!
First, I will answer to your specific question about Monitor. This is considered to be advanced, and we can't provide guarantee that the deserialisation will work. raw=True
should be used to get the JSON and do not try deserialisation (raw=True
is not available for list operations). The API Version is an attribute at the operation group level:
client = MonitorClient(**parameters)
# 2015-05-05 for instance (fake value, I don't know monitor Api Version history)
client.metric_definitions.api_version = "2015-05-05"
If you really need to call an older Api version with a 100% guarantee that the call will work, you can use the azure-mgmt-resource
package and generic call:
get_result = self.resource_client.resources.get(
resource_group_name=group_name,
resource_provider_namespace="Microsoft.Compute",
parent_resource_path="",
resource_type="availabilitySets",
resource_name=resource_name,
api_version="2015-05-01-preview",
)
Note that we are adding the multi-api version support to package currently. This is already supported in azure-mgmt-(compute/resource/storage/network/containerregistry)
These packages have a api_version
parameter, which means that you receive the correct class based on this api_version
.
(I own the SDK at MS)
Edit: improve text with raw=True