I just wanted to share a little tweak added to the PowerShell cmdlets that made it quite a bit easier to troubleshoot them as they were being built.
If you are trying to understand the Service Management API for VMs it may be useful
For most of the cmdlets that have a significant request payload such as New-AzureVM etc.. We’ve added a -Verbose switch that will dump out the underlying API request as it is executed.
For example, this snippet creates a new Windows Server 2008 R2 VM with port 80 open and a data disk attached with ReadWrite caching enabled.
New-AzureVMConfig -Name 'myvm' -ImageName 'MSFT__Win2K8R2SP1-120514-1520-141205-01-en-us-30GB.vhd' -InstanceSize 'Small' | Add-AzureProvisioningConfig -Windows -Password 'somepassword' | Add-AzureEndpoint -Name 'web' -LocalPort 80 -PublicPort 80 -Protocol tcp | Add-AzureDataDisk -CreateNew -DiskSizeInGB 50 -DiskLabel 'CacheDisk' -HostCaching 'ReadWrite' -LUN 0 | New-AzureVM -ServiceName 'myservicefromps' -Location 'East US' -Verbose
In the resulting output you can see that the New-AzureVM cmdlet actually makes two API calls in order to create the hosted service and then the new deployment. If you omit the -location parameter it will attempt to use an existing cloud service.
VERBOSE: New-AzureVM
VERBOSE: <CreateHostedService xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/windowsazure">
<ServiceName>myservicefromps</ServiceName>
<Label>bXlzZXJ2aWNlZnJvbXBz</Label>
<Description>Implicitly created hosted service2012-06-11 09:11</Description>
<Location>East US</Location>
</CreateHostedService>
New-AzureVM - Create Cloud Service 68f6b264-c97a-4e85-84f0-6f554494a0e0 Succeeded
VERBOSE: New-AzureVM
VERBOSE: <Deployment xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/windowsazure">
<Name>myservicefromps</Name>
<DeploymentSlot>Production</DeploymentSlot>
<Label>myservicefromps</Label>
<RoleList>
<Role i:type="PersistentVMRole">
<RoleName>myvm</RoleName>
<OsVersion i:nil="true" />
<RoleType>PersistentVMRole</RoleType>
<ConfigurationSets>
<ConfigurationSet i:type="WindowsProvisioningConfigurationSet">
<ConfigurationSetType>WindowsProvisioningConfiguration</ConfigurationSetType>
<ComputerName>myvm</ComputerName>
<AdminPassword>somepassword</AdminPassword>
<EnableAutomaticUpdates>true</EnableAutomaticUpdates>
<ResetPasswordOnFirstLogon>false</ResetPasswordOnFirstLogon>
</ConfigurationSet>
<ConfigurationSet i:type="NetworkConfigurationSet">
<ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
<InputEndpoints>
<InputEndpoint>
<LocalPort>3389</LocalPort>
<Name>RDP</Name>
<Protocol>tcp</Protocol>
</InputEndpoint>
<InputEndpoint>
<LocalPort>80</LocalPort>
<Name>web</Name>
<Port>80</Port>
<Protocol>tcp</Protocol>
</InputEndpoint>
</InputEndpoints>
</ConfigurationSet>
</ConfigurationSets>
<DataVirtualHardDisks>
<DataVirtualHardDisk>
<HostCaching>ReadWrite</HostCaching>
<DiskLabel>CacheDisk</DiskLabel>
<LogicalDiskSizeInGB>50</LogicalDiskSizeInGB>
<MediaLink>https://mweaststorage1.blob.core.windows.net/vhds/myservicefromps-myvm-CacheDisk-2012-6-11-649.vhd</MediaLink>
</DataVirtualHardDisk>
</DataVirtualHardDisks>
<Label>bXl2bQ==</Label>
<OSVirtualHardDisk>
<MediaLink>https://mweaststorage1.blob.core.windows.net/vhds/myservicefromps-myvm-2012-6-11-649.vhd</MediaLink>
<SourceImageName>MSFT__Win2K8R2SP1-120514-1520-141205-01-en-us-30GB.vhd</SourceImageName>
</OSVirtualHardDisk>
<RoleSize>Small</RoleSize>
</Role>
</RoleList>
</Deployment>
New-AzureVM - Create Deployment with VM myvm d0e4c5d5-9c51-422d-abfa-6e856639272c Succeeded