I'm getting the error from the title when attempting to deploy a VM. I'm using the .NET library. My code pretty much follows the MSDN article "Get Started with the Management Libraries for .NET" (which seems to have many flaws, as it does not work verbatim).
Deviations from that tutorial are:
- The method of AD auth described in the tutorial doesn't work ("the request body must contain the following parameter: 'client_secret or client_assertion'."), so I used certificate-based auth.
- The data center used in the tutorial apparently doesn't work for accounts on the free credit, so I'm using east Asia (for everything).
- For simplicity, I've created the storage account and service through the portal and am creating just the VM programmatically (eventually it'd all be made programmatically). I've tested making the service programmatically and that works fine. Although the storage account can't seem to be done ("the 'Authorization' header is not present or provided in an invalid format").
As an aside, what is with this tutorial for so many things to fail for me? Can it be fixed? Is there a better written one available?
Anyway, the image that the tutorial uses doesn't seem to exist, so I've had to use a different one. I'm currently using "03f55de797f546a1b29d1b8d66be687a__VS-2013-Community-VSU5-AzureSDK-2.7-WS2012R2", which I've confirmed is available in the east Asia data center:
PS W:\> Get-AzureVMImage | where {$_.ImageName -eq "03f55de797f546a1b29d1b8d66be687a__VS-2013-Community-VSU5-AzureSDK-2.
7-WS2012R2"}
ImageName : 03f55de797f546a1b29d1b8d66be687a__VS-2013-Community-VSU5-AzureSDK-2.7-WS2012R2
OS : Windows
MediaLink :
LogicalSizeInGB : 128
AffinityGroup :
Category : Public
Location : East Asia;Southeast Asia;Australia East;Australia Southeast;North Europe;Central India;South
India;West India;Japan West;Central US;East US 2;South Central US
Label : Visual Studio Community 2013 Update 5 with Azure 2.7 on Windows Server 2012 R2
Description : This image of Visual Studio Community 2013 Update 5 with Azure Tools 2.7 enables you to unleash
the full power of Visual Studio to develop cross-platform solutions. Create apps in one
unified IDE, and incorporate new languages, features, and development tools into them with
Visual Studio Extensions (available in the Visual Studio Gallery).
Eula : http://go.microsoft.com/fwlink/?LinkID=430755
ImageFamily : Visual Studio Community 2013 Update 5 with Azure 2.7 on Windows Server 2012 R2
PublishedDate : 2015-07-20 01:00:00
IsPremium : False
IconUri : VisualStudio2013_45.png
SmallIconUri : VisualStudio2013_45.png
PrivacyUri : http://go.microsoft.com/fwlink/?LinkID=286720
RecommendedVMSize : Standard_D2
PublisherName : Microsoft Visual Studio Group
IOType : Standard_LRS
ShowInGui :
IconName : VisualStudio2013_45.png
SmallIconName : VisualStudio2013_45.png
OperationDescription : Get-AzureVMImage
OperationId : 8e654178-6aa2-18f6-b3dc-5395061c63c7
OperationStatus : Succeeded
I've tried numerous other VM images and they all get this same error. The tutorial doesn't mention anything else that I'm supposed to do. I don't really care about what image I'm using at the moment (but ultimately it's going to need to be a mostly barebones Windows Server 2012 machine with IIS and .NET). I'm pretty much following the tutorial for a T in creating the OSVirtualHardDisk
:
OSVirtualHardDisk vhd = new OSVirtualHardDisk
{
SourceImageName = imageName,
HostCaching = VirtualHardDiskHostCaching.ReadWrite,
MediaLink = new Uri(string.Format("https://{0}.blob.core.windows.net/vhds/{1}.vhd", storageName, imageName)),
};
I have no idea what the heck I'm supposed to do or why the tutorial's code doesn't work for me. Please advise.