Node.JS
Node.JS

Reputation: 1592

Managed azure storage account via powershell for VM

I am trying to create a VM using AZ PowerShell but I get an error.

New-AzVM : Using a client owned (un-managed) storage account for boot diagnostics is not supported for VMs.
ErrorCode: OperationNotAllowed
ErrorMessage: Using a client owned (un-managed) storage account for boot diagnostics is not supported for VMs.
ErrorTarget:
StatusCode: 409
ReasonPhrase: Conflict
OperationID : 
+         New-AzVM -ResourceGroupName $primaryResourceGroupName -Locati ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzVM], ComputeCloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand

I am wondering

  1. how to check if my storage account is managed or unmanaged
  2. how to make the storage account to be managed?

Upvotes: 0

Views: 261

Answers (1)

AjayKumarGhose
AjayKumarGhose

Reputation: 4923

To more specific to your ask

  • 1 . how to check if my storage account is managed or unmanaged

Run the following cmd to check whether the VM OS DISK is managed or unmanaged :

(get-azurermvm -ResourceGroupName NAME -Name yourvm).StorageProfile.OsDisk

Here is the sample screenshot with unmanaged disk VM .

enter image description here

  • 2.how to make the storage account to be managed?

Now we need to stop the VM to convert Unmanaged to managed disk

Run the below cmd to STOP the VM

$rgName = "myResourceGroup"
$vmName = "myVM"
Stop-AzVM -ResourceGroupName $rgName -Name $vmName -Force

enter image description here

  • Then Run this cmd to convert to Managed disk

    ConvertTo-AzVMManagedDisk -ResourceGroupName $rgName -VMName $vmName

Here are the reference output of successfully converted : enter image description here

enter image description here

For more information please refer this MS DOC: Create VM & Convert Single Instance VM

Upvotes: 1

Related Questions