I am trying to create a VM in Azure using powershell. I am running this on my local PC. I have been able to setup websites and SQL Azure instances without any issues but None of the samples on the web work.
Import-Module Azure
Import-AzurePublishSettingsFile -PublishSettingsFile "C:\Cloud\Azure.publishsettings"
$VMImage = @(Get-AzureVMImage | Where-Object -Property Label -Match "Windows Server 2012 R2 Datacenter, November 2014").ImageName
$myVMName = "jsTestVM1"
$myAdminName ="jsTestAdmin1"
$myAdminPwd ="not telling you"
New-AzureQuickVM -ImageName $VMImage -Windows -Name $myVMName -ServiceName $myVMName -AdminUsername $myAdminName -Password $myAdminPwd -InstanceSize "ExtraSmall"
I get the following message:
New-AzureQuickVM : ResourceNotFound: The hosted service does not exist.
At line:1 char:1
+ New-AzureQuickVM -ImageName $VMImage -Windows -Name $myVMName -ServiceName $myVM ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureQuickVM], CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs.NewQuickVM
I've tried samples from the web and they give the same error message as well.
Edit:
If I specify a location I get the error message 'Service already exists, Location cannot be specified'. If I specify AffinityGroup I get 'Service already exists, AffinityGroup cannot be specified'