#login to Rm Account
Login-AzureRmAccount
#alternative
#$vmname = "centosweb1hdicp"
#select the subscription id
$subscriptionId =
(Get-AzureRmSubscription
|
Out-GridView
`
-Title "Select an Azure Subscription ..." `
-PassThru).SubscriptionId
Select-AzureRmSubscription `
-SubscriptionId
$subscriptionId
#select vm
$centosvm =
(Get-AzureRmVM
|
Out-GridView
`
-Title "Select an Azure Resource Group ..." `
-PassThru)
#select the resource group
$rgName = $centosvm.ResourceGroupName
#select the resource group/alternative
#$rgName =
#
(Get-AzureRmResourceGroup |
# Out-GridView `
# -Title
"Select an Azure Resource Group ..." `
#
-PassThru).ResourceGroupName
#collect VM / alternative
#$centosvm = Get-AzureRmVM | Where-Object {$_.Name -eq
"$vmname"}
# current size
$currVMSize=$centosvm.HardwareProfile.VirtualMachineSize
Write-Host "Current
Size of the VM: $currVMSize" -BackgroundColor
Red -ForegroundColor
Cyan
#collect location
$location=(Get-AzureRmResourceGroup -Name
$rgName).Location
#collect new size
$newVMSize =
(Get-AzureRmVMSize
-Location $location
|
Out-GridView
`
-Title "Select a VM Size ..." `
-PassThru).Name
# Stop VM
$centosvm | Stop-AzureRmVm -Force
# Resize VM
$centosvm.HardwareProfile.VirtualMachineSize =
$newVMSize
$centosvm | Update-AzureRmVM
# Start VM
$centosvm | Start-AzureRmVm
very informative blog and useful article thank you for sharing with us , keep posting learn more
ReplyDeleteAzure Online Course Hyderabad
THE VERY SHORT AND SWEET INFORMATION
ReplyDeleteAzure Training in Chennai | Certification | Azure Online Training Course | Azure Training in Bangalore | Certification | Azure Online Training Course | Azure Training in Hyderabad | Certification | Azure Online Training Course | Azure Training in Pune | Certification | Azure Online Training Course | Azure Training | microsoft azure certification | Azure Online Training Course