I’m have an Azure PowerShell challenge.
I am trying to create a VM with a static IP based on an existing disk.
I have run the following and can see my disk in the list of VM disks
Add-AzureDisk -DiskName $diskname -MediaLocation $medialocation -Label "bootdisk" -OS "Linux"
However when I run the following script:
Set-AzureSubscription -SubscriptionName "my subscrption" -CurrentStorageAccountName "my storage account"
$vmImg = New-AzureVMConfig -Name $vmname -InstanceSize Large -DiskName $diskname -Verbose |
Set-AzureSubnet -SubnetNames "my subnet" |
Set-AzureStaticVNetIP -IPAddress "192.168.58.101"
New-AzureVM -ServiceName $cloudservicename -VMs $vmImg
I get this error
New-AzureVM : CurrentStorageAccountName is not accessible. Ensure the current storage account is accessible and in the same location or affinity group as your cloud service
I did some research and found that is an issue when the cloud service already exits. However, I have tried all the workarounds suggested including allowing the New-AzureVM to create the cloud service and to create it manually.
Have you come across this? The reason I need the static IP is that everything in the VM breaks if I allow dynamic IP.
Any suggestions would be greatly appreciated.