Created
December 21, 2021 02:08
-
-
Save ChendrayanV/1ce319eb76fcf3ec22fb0cfb6539878d to your computer and use it in GitHub Desktop.
Resize Azure VM - REST API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Body = [pscustomobject]@{ | |
properties = [pscustomobject]@{ | |
hardwareProfile = [pscustomobject]@{ | |
vmSize = 'Standard_D2s_v3' | |
} | |
} | |
} | ConvertTo-Json -Compress | |
$SubcriptionId = '' | |
$ResourceGroup = '' | |
$VMName = '' | |
$Uri = "https://management.azure.com/subscriptions/$($SubcriptionId)/resourceGroups/$($ResourceGroup)/providers/Microsoft.Compute/virtualMachines/$($VMName)?api-version=2021-07-01" | |
Invoke-RestMethod -Method Patch -Uri $Uri -Body $Body -Headers @{'Authorization' = "Bearer {0}" -f (Get-AzAccessToken).Token } -ContentType 'application/json' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment