Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This script retrieves resources from a managed resource group, and resizes the VMs in that resource group.
If you don't have an Azure subscription, create a trial account before you begin.
# Get managed applications from known resource group
Get-AzManagedApplication -ResourceGroupName "DemoApp"
# Get ID of managed resource group
(Get-AzManagedApplication -ResourceGroupName "DemoApp").Properties.managedResourceGroupId
# Get virtual machines in the managed resource group
Get-AzResource -ResourceGroupName DemoApp6zkevchqk7sfq -ResourceType Microsoft.Compute/virtualMachines
# Get information about virtual machines in managed resource group
Get-AzVM -ResourceGroupName DemoApp6zkevchqk7sfq | ForEach{ $_.Name, $_.storageProfile.osDisk.osType, $_.hardwareProfile.vmSize }
## Resize virtual machines in managed resource group
$vm = Get-AzVM -ResourceGroupName DemoApp6zkevchqk7sfq -VMName demoVM
$vm.HardwareProfile.VmSize = "Standard_D2_v2"
Update-AzVM -VM $vm -ResourceGroupName DemoApp6zkevchqk7sfq
This script uses the following commands to deploy the managed application. Each command in the table links to command-specific documentation.
Command | Notes |
---|---|
Get-AzManagedApplication | List managed applications. Provide resource group name to focus the results. |
Get-AzResource | List resources. Provide a resource group and resource type to focus the result. |
Update-AzVM | Update a virtual machine's size. |
- For an introduction to managed applications, see Azure Managed Application overview.
- For more information on PowerShell, see Azure PowerShell documentation.