Azure Resource Manager Cmdlets - PowerShell Reference

This section provides comprehensive documentation for the Azure Resource Manager (ARM) cmdlets available in PowerShell. These cmdlets enable you to manage your Azure resources efficiently using PowerShell scripts.

Core Cmdlets

Get-AzResource
Gets information about Azure resources.
Get-AzResource [-Name <String>] [-ResourceType <String>] [-Location <String>] [-ResourceGroupName <String>] [-ApiVersion <String>] [-ODataQuery <String>] [-Expand <String>] [-Filter <String>] [-Skip <Int64>] [-Top <Int64>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]

Parameters

  • -Name: Specifies the name of the resource.
  • -ResourceType: Specifies the type of the resource (e.g., Microsoft.Web/sites).
  • -ResourceGroupName: Specifies the name of the resource group.

Example

Get-AzResource -ResourceGroupName "MyResourceGroup" -ResourceType "Microsoft.Compute/virtualMachines"
                
New-AzResourceGroup
Creates a new resource group.
New-AzResourceGroup -Name <String> -Location <String> [-Tag <Hashtable>] [-Force] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]

Parameters

  • -Name: The name of the new resource group.
  • -Location: The Azure region for the resource group.

Example

New-AzResourceGroup -Name "WebAppRG" -Location "East US" -Tag @{"Environment"="Production"}
                
Remove-AzResource
Deletes an Azure resource.
Remove-AzResource -Name <String> -ResourceType <String> -ResourceGroupName <String> [-ApiVersion <String>] [-Force] [-AsJob] [-WhatIf] [-Confirm] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]

Parameters

  • -Name: The name of the resource to delete.
  • -ResourceType: The type of the resource.
  • -ResourceGroupName: The resource group containing the resource.

Example

Remove-AzResource -Name "myVM" -ResourceType "Microsoft.Compute/virtualMachines" -ResourceGroupName "VMs" -Force
                
Set-AzResource
Updates an Azure resource.
Set-AzResource -Name <String> -ResourceType <String> -ResourceGroupName <String> -Value <PSObject> [-ApiVersion <String>] [-Force] [-AsJob] [-WhatIf] [-Confirm] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]

Parameters

  • -Name: The name of the resource to update.
  • -ResourceType: The type of the resource.
  • -ResourceGroupName: The resource group containing the resource.
  • -Value: A JSON string or PowerShell object representing the updated resource properties.

Example

$resource = Get-AzResource -Name "myApp" -ResourceType "Microsoft.Web/sites" -ResourceGroupName "AppServiceRG"
$resource.Tags = @{"Status"="In Progress"}
Set-AzResource -Name "myApp" -ResourceType "Microsoft.Web/sites" -ResourceGroupName "AppServiceRG" -Value $resource
                

Deployment Cmdlets

New-AzResourceGroupDeployment
Deploys resources to a resource group using an ARM template.
New-AzResourceGroupDeployment -Name <String> -ResourceGroupName <String> -TemplateFile <String> [-TemplateParameterFile <String>] [-Parameter <String[]>] [-Mode <DeploymentMode>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]

Parameters

  • -Name: A unique name for the deployment.
  • -ResourceGroupName: The target resource group.
  • -TemplateFile: Path to the ARM template JSON file.
  • -TemplateParameterFile: Path to the ARM template parameters JSON file.

Example

New-AzResourceGroupDeployment -Name "storageDeployment" -ResourceGroupName "StorageRG" -TemplateFile ".\azuredeploy.json" -TemplateParameterFile ".\azuredeploy.parameters.json"
                
Get-AzResourceGroupDeployment
Gets the status of deployments to a resource group.
Get-AzResourceGroupDeployment [-Name <String>] -ResourceGroupName <String> [-ApiVersion <String>] [-ODataQuery <String>] [-Expand <String>] [-Filter <String>] [-Skip <Int64>] [-Top <Int64>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Remove-AzResourceGroupDeployment
Deletes a deployment from a resource group.
Remove-AzResourceGroupDeployment -Name <String> -ResourceGroupName <String> [-Force] [-AsJob] [-WhatIf] [-Confirm] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]

Related Topics