Powershell script to convert Premium SSD disk to standard HDD
# Name of the resource group that contains the VM
$rgName = 'MYResourceGroupName'
# Name of the your virtual machine
$vmName = 'MyVirtualMachineName'
# Choose between Standard_LRS and Premium_LRS based on your scenario
$storageType = 'Standard_LRS'
# Premium capable size
# Required only if converting storage from Standard to Premium
#$size = 'Standard_DS2_v2'
#Provide the subscription Id where Managed Disks will be created
$subscriptionId = 'd7x2bxx8-62xe-4xdx-xa8x-20x0x3x2x5xx'
Select-AzSubscription -SubscriptionId $SubscriptionId
# Stop and deallocate the VM before changing the size
Stop-AzVM -ResourceGroupName $rgName -Name $vmName -Force
$vm = Get-AzVM -Name $vmName -resourceGroupName $rgName
# Change the VM size to a size that supports Premium storage
# Skip this step if converting storage from Premium to Standard
#$vm.HardwareProfile.VmSize = $size
#Update-AzVM -VM $vm -ResourceGroupName $rgName
# Get all disks in the resource group of the VM
$vmDisks = Get-AzDisk -ResourceGroupName $rgName
# For disks that belong to the selected VM, convert to Premium storage
foreach ($disk in $vmDisks)
{
if ($disk.ManagedBy -eq $vm.Id)
{
$diskUpdateConfig = New-AzDiskUpdateConfig –AccountType $storageType
Update-AzDisk -DiskUpdate $diskUpdateConfig -ResourceGroupName $rgName `
-DiskName $disk.Name
}
}
Start-AzVM -ResourceGroupName $rgName -Name $vmName
Subscribe to:
Post Comments (Atom)
Create a Directory from existing disk in proxmox server
Scenario: I have an NVMe disk with an ext4 partition that was previously used as a directory in a Proxmox server. After reinstalling Proxm...
-
This solution Works for TFS 2010+ . Open Visual studio Command prompt and run the following script. tf workspace /delete /server:[Site:Port/...
-
for example, the login name is 'mysqluserlogin' 1) Enable the disabled login: ALTER LOGIN mysqluserlogin ENABLE ; 2) Change the lo...
-
Problem 1) 2019-07-02T14:19:12.5157398Z fatal: unable to access 'https://tfssite.company.com/tfs/UK_ProjectCollection/SalesPortal/_git/S...
No comments:
Post a Comment