I am posting the below xml request using the REST api to create a VM deployment and also set the DSCExtension. The VM is created successfully, but I don't see the DSC plugin being installed. Appreciate if some one has went through this and may be able to help me out. Thanks!.
This is how I create my request body.
// Create the request to add a new Virtual Machine deployment
XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
XDocument requestBody = new XDocument(
new XDeclaration("1.0", "UTF-8", "no"),
new XElement(wa + "Deployment",
new XElement(wa + "Name", DeploymentName),
new XElement(wa + "DeploymentSlot", DeploymentSlot),
new XElement(wa + "Label", DeploymentLabel),
new XElement(wa + "RoleList",
new XElement(wa + "Role",
new XElement(wa + "RoleName", RoleName),
new XElement(wa + "RoleType", "PersistentVMRole"),
new XElement(wa + "ConfigurationSets",
new XElement(wa + "ConfigurationSet",
new XAttribute(xsi + "type", "WindowsProvisioningConfigurationSet"),
new XElement(wa + "ConfigurationSetType", "WindowsProvisioningConfiguration"),
new XElement(wa + "ComputerName", RoleName),
new XElement(wa + "AdminPassword", AdminPassword),
new XElement(wa + "AdminUsername", UserName))),
new XElement(wa + "OSVirtualHardDisk",
new XElement(wa + "MediaLink", OSVhdPath),
new XElement(wa + "SourceImageName", SourceImage)),
new XElement(wa + "RoleSize", "A6"),
new XElement(wa + "ProvisionGuestAgent", "true"),
new XElement(wa + "ResourceExtensionReferences",
new XElement(wa + "ResourceExtensionReference",
new XElement(wa + "ReferenceName", "BGInfo"),
new XElement(wa + "Publisher", "Microsoft.Compute"),
new XElement(wa + "Name", "BGInfo"),
new XElement(wa + "Version", "1.*")
),
new XElement(wa + "ResourceExtensionParameterValues"),
new XElement(wa + "State", state),
new XElement(wa + "ResourceExtensionReference",
new XElement(wa + "ReferenceName", ReferenceName),
new XElement(wa + "Publisher", Publisher),
new XElement(wa + "Name", Name),
new XElement(wa + "Version", Ver),
new XElement(wa + "ResourceExtensionParameterValues",
new XElement(wa + "ResourceExtensionParameterValue",
new XElement(wa + "Key", key),
new XElement(wa + "Value",
DCDSCValue),
new XElement(wa + "Type",
type)
)),
new XElement(wa + "State",
state)
)
)
))));
This is the XML I get when I export the VM after it is created. I don't see any settings for <ResourceExtensionReferences />. Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<PersistentVM xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ConfigurationSets>
<ConfigurationSet xsi:type="NetworkConfigurationSet">
<ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
<InputEndpoints>
<InputEndpoint>
<LocalPort>3389</LocalPort>
<Name>Remote Desktop</Name>
<Port>3389</Port>
<Protocol>tcp</Protocol>
<Vip>138.91.188.39</Vip>
<EnableDirectServerReturn>false</EnableDirectServerReturn>
<IdleTimeoutInMinutes xsi:nil="true" />
</InputEndpoint>
</InputEndpoints>
<SubnetNames />
<PublicIPs />
<NetworkInterfaces />
</ConfigurationSet>
</ConfigurationSets>
<DataVirtualHardDisks />
<OSVirtualHardDisk>
<HostCaching>ReadWrite</HostCaching>
<DiskName>RestDeploy-dccontroller6-0-201503221101480600</DiskName>
<SourceImageName>a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201412.01-en.us-127GB.vhd</SourceImageName>
<OS>Windows</OS>
<IOType>Standard</IOType>
<ResizedSizeInGB xsi:nil="true" />
</OSVirtualHardDisk>
<RoleName>dccontroller6</RoleName>
<RoleSize>A6</RoleSize>
<RoleType>PersistentVMRole</RoleType>
<NoExportPrivateKey>false</NoExportPrivateKey>
<NoRDPEndpoint>false</NoRDPEndpoint>
<NoSSHEndpoint>false</NoSSHEndpoint>
<ProvisionGuestAgent>true</ProvisionGuestAgent>
<ResourceExtensionReferences />
</PersistentVM>