Azure PowerShell Az.Resources Reference

Az.Resources
Version: 5.0.0

This module provides cmdlets for managing Azure resources, resource groups, deployments, and policy assignments.

Cmdlets

Get-AzResource

Gets information about Azure resources.

Get-AzResource [-ApiVersion <String>] [-ExpandProperties <String>] [-Force] [-Id <String>] [-Location <String>] [-Name <String>] [-ODataQuery <String>] [-PageSize <Int32>] [-Pre <SwitchParameter>] [-ResourceGroupName <String>] [-ResourceType <String>] [-StatusMessage] [-SubscriptionId <String>] [-Tag <Hashtable>] [-TenantId <String>] [-WhatIf] [-Confirm] [<CommonParameters>] Parameters:
  • -ApiVersion[String]: Specifies the API version to use for the request.
  • -Id[String]: The resource ID to get.
  • -Name[String]: The name of the resource.
  • -ResourceGroupName[String]: The name of the resource group.
  • -ResourceType[String]: The type of the resource.
Examples:
  • Get all resources in a resource group: Get-AzResource -ResourceGroupName "MyResourceGroup"
  • Get a specific resource by ID: Get-AzResource -Id "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"
New-AzResourceGroup

Creates a resource group.

New-AzResourceGroup [-Name] <String> [-Location <String>] [-Tag <Hashtable>] [-Force] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [ Parameters:
  • -Name[String]: The name of the resource group to create.
  • -Location[String]: The Azure region where the resource group will be created.
  • -Tag[Hashtable]: A hash table of tags to assign to the resource group.
Examples:
  • Create a resource group in West US: New-AzResourceGroup -Name "MyNewResourceGroup" -Location "West US"
  • Create a resource group with tags: New-AzResourceGroup -Name "TaggedGroup" -Location "East US" -Tag @{Environment="Dev"; Project="Alpha"}
Remove-AzResourceGroup

Deletes a resource group.

Remove-AzResourceGroup [-Name] <String> [-Location <String>] [-DeleteResources] [-Force] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [ Parameters:
  • -Name[String]: The name of the resource group to delete.
  • -Force[SwitchParameter]: Suppresses confirmation prompts.
Examples:
  • Delete a resource group (with confirmation): Remove-AzResourceGroup -Name "MyResourceGroupToDelete"
  • Delete a resource group without confirmation: Remove-AzResourceGroup -Name "MyResourceGroupToDelete" -Force
Set-AzResource

Updates a resource.

Set-AzResource [-Name] <String> [-ResourceGroupName] <String> [-ResourceType] <String> [-ApiVersion <String>] [-Force] [-Operation <Operation>] [-Property <Hashtable>] [-Tag <Hashtable>] [-WhatIf] [-Confirm] [ Parameters:
  • -Name[String]: The name of the resource.
  • -ResourceGroupName[String]: The name of the resource group.
  • -ResourceType[String]: The type of the resource.
  • -Tag[Hashtable]: A hash table of tags to assign to the resource.
Examples:
  • Update tags on a resource: Set-AzResource -Name "myVM" -ResourceGroupName "MyResourceGroup" -ResourceType "Microsoft.Compute/virtualMachines" -Tag @{Status="Running"}
Get-AzResourceGroupDeployment

Gets deployments for a resource group.

Get-AzResourceGroupDeployment [-ResourceGroupName] <String> [-Name <String>] [-Pre] [-StatusMessage] [ Parameters:
  • -ResourceGroupName[String]: The name of the resource group.
  • -Name[String]: The name of the deployment to get.
Examples:
  • Get all deployments for a resource group: Get-AzResourceGroupDeployment -ResourceGroupName "MyResourceGroup"