I'm trying to add a disk to a VM in Azure using the following PowerShell script:
$rgName = "${resourceManager}"
$stName = "${storageAccount}"
$diskname="${diskName}"
$lun = ${lunNum}
$vmName = "${vmName}"
$diskSize=${diskSize}
$storageAcc=Get-AzureRmStorageAccount -ResourceGroupName $rgName -Name $stName
$diskpath=$storageAcc.PrimaryEndpoints.Blob.ToString() + "vhds/" + $diskname + ".vhd"
$vm = Get-AzureRmVM -ResourceGroupName $rgName -Name $vmName | Add-AzureRmVMDataDisk -Name $diskname -VhdUri $diskpath -CreateOption empty -DiskSizeInGB $diskSize -Lun $lun
$vm.Tags = $null
$vm | Update-AzureRmVM
The following are descriptions of the values I need:
SubscriptionID - Azure Subscription ID
AzureUsername - Name of Azure service account. It must be configured as co-administrator on the Azure Subscription
AzurePassword - Associated Azure service account password
resourceManager - Name of Resource Manager (RM) containing the VM
storageAccount - Name of storage account (within the specified RM), where to create the new disk
diskName - desired name of the disk
diskSize - desired size of the disk in Giga Bytes, this is a quota, up to 1000 GB is allowed
lunNum - the lun number to use, valid values are 0,1,2,3, etc.
vmName - the name of an existing VM where to attach the new disk
The following are test values I use in the script:
SubscriptionID - 06e2bb3d-e66d-4a21-a4a0-78b2fe53f8c6
AzureUsername – [email protected]
AzurePassword – test123
resourceManager –
storageAccount -
diskName - test
diskSize - 100
lunNum -
vmName - ALPHABETTVM001
I'm unsure where to procure the resourceManager, storageAccount, and lunNum inputs. I'm functionally testing Azure scripts that have been converted from the old ASM to new ARM model, but I don't have a lot of experience with this. Where can I find these three values for my given virtual machine?
