Reputation: 3830
I have a managed disk which contains OS but which is not marked as having operating system (OSType property is empty). How do I change that property so I can create new VM from within portal?
PS Azure:\> $disk
ResourceGroupName : KoreaCentralShared
ManagedBy :
Sku : Microsoft.Azure.Management.Compute.Models.DiskSku
Zones :
TimeCreated : 12/18/18 9:45:26 PM
OsType :
CreationData : Microsoft.Azure.Management.Compute.Models.CreationData
DiskSizeGB : 80
EncryptionSettings :
ProvisioningState : Succeeded
DiskIOPSReadWrite :
DiskMBpsReadWrite :
Id : /subscriptions/5171/resourceGroups/K/providers/Microsoft.Compute/disks/RHEL_DataDisk_0
Name : RHEL_DataDisk_0
Type : Microsoft.Compute/disks
Location : koreacentral
Tags : {}
Upvotes: 0
Views: 2270
Reputation: 1706
You should be able to update the OsType using commands below.
Example:
$update = New-AzureRmDiskUpdateConfig -OsType <OSType>
Update-AzureRmDisk -DiskName <diskname> -DiskUpdate $update -ResourceGroupName <rgname>
Personally i would copy the Disk to a new disk and specify the osType on new disk creation
Example:
$managedDisk = Get-AzureRmDisk -DiskName <diskname> -ResourceGroupName <rgname>
$diskConfig = New-AzureRmDiskConfig -SourceResourceId $managedDisk.Id -Location $managedDisk.Location -CreateOption Copy -OsType Linux
New-AzureRmDisk -Disk $diskConfig -DiskName <Newdiskname> -ResourceGroupName <rgname>
Hope this helps.
Upvotes: 1