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.
- 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
Parameters:
Creates a resource group.
New-AzResourceGroup [-Name] <String> [-Location <String>] [-Tag <Hashtable>] [-Force] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [- -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.
- 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
Parameters:
Deletes a resource group.
Remove-AzResourceGroup [-Name] <String> [-Location <String>] [-DeleteResources] [-Force] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [- -Name[String]: The name of the resource group to delete.
- -Force[SwitchParameter]: Suppresses confirmation prompts.
- Delete a resource group (with confirmation):
Remove-AzResourceGroup -Name "MyResourceGroupToDelete" - Delete a resource group without confirmation:
Remove-AzResourceGroup -Name "MyResourceGroupToDelete" -Force
Set-AzResource
Parameters:
Updates a resource.
Set-AzResource [-Name] <String> [-ResourceGroupName] <String> [-ResourceType] <String> [-ApiVersion <String>] [-Force] [-Operation <Operation>] [-Property <Hashtable>] [-Tag <Hashtable>] [-WhatIf] [-Confirm] [- -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.
- Update tags on a resource:
Set-AzResource -Name "myVM" -ResourceGroupName "MyResourceGroup" -ResourceType "Microsoft.Compute/virtualMachines" -Tag @{Status="Running"}
Get-AzResourceGroupDeployment
Parameters:
Gets deployments for a resource group.
Get-AzResourceGroupDeployment [-ResourceGroupName] <String> [-Name <String>] [-Pre] [-StatusMessage] [- -ResourceGroupName[String]: The name of the resource group.
- -Name[String]: The name of the deployment to get.
- Get all deployments for a resource group:
Get-AzResourceGroupDeployment -ResourceGroupName "MyResourceGroup"