Delete (DELETE) a VirtualMachine [SPFSDK][VMMREF]

 

Applies To: Windows Azure Pack

Deletes a VirtualMachine [SPFSDK][VMMREF] entity by using the HTTP DELETE operation.

Here is a list of examples related to this collection operation.

For more information about the placeholders used in the URI, see URL placeholders.

Method

Request URI

HTTP Version

DELETE

https://{server-name}:{auth-port}/{subscription-id}/services/systemcenter/vmm/VirtualMachines(ID=Guid'[value]',StampId=Guid'[value]')

HTTP/1.1

URI Parameter

Description

ID

Required. [Edm.Guid] The identifier of the entity.

StampId

Required. [Edm.Guid] The identifier of the stamp that restricts the query.

This operation does not use any non-standard request headers.

For more information about the common request headers used by this operation, see Common HTTP request information

This operation does not return any non-standard OData response codes. If successful, it will return code 204 No Content.

This operation does not use any non-standard response headers.

For more information about the common response headers used by this operation, see Common HTTP response information.

The following example deletes a virtual machine.

For more information about how to get started with using the code examples provided in this programming guide, see Programming in Visual Studio with Service Provider Foundation Services.

Guid stampId = new Guid("d70c1a9b-c241-48f5-880a-b6c36071e653");
Guid virtualMachineId = new Guid("38c9c3b9-9288-4d7a-82fa-501cd4eb9ecb");

var vm = vmmService.VirtualMachines.Where(v => v.StampId == stampId && v.ID == virtualMachineId).First();

vmmService.DeleteObject(vm);
vmmService.SaveChanges();

DELETE https://contoso.com:30005/ae122d5f-3aab-4d75-ad48-d6593246a49e/services/systemcenter/vmm/VirtualMachines(ID=guid'38c9c3b9-9288-4d7a-82fa-501cd4eb9ecb',StampId=guid'd70c1a9b-c241-48f5-880a-b6c36071e653') HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: Bearer {ENCODED AUTHENTICATION TOKEN}
x-ms-principal-id: tenant@fabrikam.com
Host: contoso.com:30005

HTTP/1.1 204 No Content
Cache-Control: no-cache
Content-Length: 0
Server: Microsoft-IIS/8.5
x-ms-request-id: 1c6d7468-40ef-4315-a45a-c8bd42133098
X-Content-Type-Options: nosniff
request-id: d3df681c-b278-0000-82d1-e1d378b2cf01
DataServiceVersion: 1.0;
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Thu, 04 Sep 2014 22:28:24 GMT
Show: