Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies To: Windows Azure Pack
The virtual machines hosted by a virtual machine role (VM role) VM role instance are part the VMs resource of a specific VM role. To get a single virtual machine instance, you must know its identifier.
Get a single virtual machine from a virtual machine role instance
Tip
To learn how to get a virtual machine role instance, see Get a VM Role Instance [SPFSDK][VMROLE].
A specific virtual machine is referenced by its id property (which is a GUID) and is located at http://server-name:server-port/subscription-id/CloudServices/cloudservice-name/Resources/MicrosoftCompute/VMRoles/vmrole-name/VMs/vm-id/. Use an HTTP GET request to retrieve the virtual machine.
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 single virtual machine from 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/VMs/73b04c76-ad83-45bf-ba8a-90b07e4029d8?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: 303
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-0001-3242-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 20:10:02 GMT
{
"ComputerName": "LAMP001.mydns1",
"ConnectToAddresses": [{
"IPAddress": "10.0.0.2",
"NetworkName": "Network1",
"Port": 3389
}],
"Id": "73b04c76-ad83-45bf-ba8a-90b07e4029d8",
"RuntimeState": "Running",
"odata.metadata": "https://spfserver:8090/SC2012R2/VMM/Microsoft.Management.Odata.svc/$metadata#VM/@Element"
}
See Also
VM Role Instances [SPFSDK][VMROLE]
Get a VM Role Instance [SPFSDK][VMROLE]
Get all of the Virtual Machines [SPFSDK][VMROLE]
Repair a VM Role [SPFSDK][VMROLE]
Scale a VM Role [SPFSDK][VMROLE]