Get a VM Role Instance [SPFSDK][VMROLE]
Applies To: Windows Azure Pack
At some point, you will need to retrieve an instance of a virtual machine role (VM role). With reference to a VM role, you can create or delete virtual machines, and manage the existing virtual machines that have been previously created.
Get a virtual machine role instance
A VM role instance is located at the following URI: http://server-name:server-port/subscription-id/CloudServices/cloudservice-name/Resources/MicrosoftCompute/VMRoles/vmrole-name.
Tip
For more information about the placeholders used in the URL, see URL Cheat Sheet for VM Roles [SPFSDK][VMROLE].
Important
Anytime you access a resource within cloud services, you must append the api-version=2013-03 query string. The query string always starts with the ? character after the URL.
Get a virtual machine role instance with HTTP
Use a GET HTTP operation.
Set the URI of the HTTP operation to the format previously described.
Set the x-ms-principal-id header to the email of the tenant associated with the current subscription.
If you want to use json as the response type add the Accept header and set the value to application/json
Set any other standard HTTP headers, such as those related to authentication tokens, and add any authentication certificates that may be required.
Submit the request.
HTTP GET request
GET https://smapiserver:30005/f86b0bc2-6825-4e5b-961b-10d5901f7572/CloudServices/CloudService1/Resources/MicrosoftCompute/VMRoles/VMRole1?api-version=2013-03 HTTP/1.1
x-ms-principal-id: tenant@contoso.com
Accept: application/json
Host: smapiserver:30005
HTTP GET response
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 4846
Content-Type: application/json; odata=minimalmetadata; streaming=true; charset=utf-8
Server: Microsoft-IIS/8.5
X-Content-Type-Options: nosniff
request-id: 33c9dafc-df0d-0000-ea83-ca330ddfce01
DataServiceVersion: 3.0;
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Thu, 14 Nov 2013 02:02:09 GMT
{
"InstanceView": {
"InstanceCount": "1",
"ResolvedResourceDefinition": { ... omitted for brevity ... },
"VIPs": []
},
"Label": "VMRole1",
"Name": "VMRole1",
"ProvisioningState": "Provisioned",
"ResourceConfiguration": { ... omitted for brevity ... },
"ResourceDefinition": { ... omitted for brevity ... },
"Substate": { "VMRoleMessages": [] },
"odata.metadata": "https://spfserver:8090/SC2012R2/VMM/Microsoft.Management.Odata.svc/$metadata#VMRole/@Element"
}
See Also
VM Role Instances [SPFSDK][VMROLE]
Get all of the Virtual Machines [SPFSDK][VMROLE]
Get a Single Virtual Machine [SPFSDK][VMROLE]
Repair a VM Role [SPFSDK][VMROLE]
Scale a VM Role [SPFSDK][VMROLE]