Azure-sdk-for-python: Instance view of virtual machine

Created on 17 Mar 2016  路  5Comments  路  Source: Azure/azure-sdk-for-python

I'm using Azure Python SDK 2.0.0rc1.

I want to get instance view of virtual machine.
ex) https://msdn.microsoft.com/en-us/library/azure/mt163682.aspx

But I could not find VirtualMachine.get_instance_view method().
How do I get instance view of virtual machine?

thanks.

ARM Docs Service Attention

Most helpful comment

Helpful!!!

All 5 comments

I think this could be interesting to read:
https://github.com/Azure/azure-rest-api-specs/issues/117

You have to use the expand parameter with the instanceview string.

In addition, I saw that the latest version of the Swagger file replaces the string parameter by an enum parameter to make this more clear.
https://github.com/Azure/azure-rest-api-specs/blob/master/arm-compute/2015-06-15/swagger/compute.json#L1022
If think I will update the SDK in the rc2 to get this modification, this will be more clear.

Could you try and confirm that this solves your problem?

Thank you!

@lmazuel
Thank you for your advice. I was able to resolve this problem.
I read the rest-api-specs#117 issue and understood it.
So I tried to use expand parameter.

vm = compute_client.virtual_machines.get(resource_group_name, name, expand = 'instanceview')

I cloud get an insntance view of virtual mahcine.

Thanks.

Thank you for your confirmation!

I add this specific case in our unit tests suite to be safe.

Please feel free to reopen if something is not correct!

Helpful!!!

I am trying to get the vm status (running or stopped). As suggested above I tried
vm = compute_client.virtual_machines.get(resource_group_name, name, expand = 'instanceview')
But this will get me instance view for one server in each get req. We have too many servers in azure, this will not be good for us as too many calls will be made. Is there a way, we can get instance view for all servers in one get request and later we can vm status for each vm.

Was this page helpful?
0 / 5 - 0 ratings