Get-AzResource
Gets resources.
Get-AzResource
[-Name <String>]
[-ResourceType <String>]
[-ODataQuery <String>]
[-ResourceGroupName <String>]
[-TagName <String>]
[-TagValue <String>]
[-ExpandProperties]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzResource
-ResourceId <String>
[-ODataQuery <String>]
[-ExpandProperties]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzResource
[-Name <String>]
[-ResourceType <String>]
[-ODataQuery <String>]
[-ResourceGroupName <String>]
-Tag <Hashtable>
[-ExpandProperties]
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
The Get-AzResource cmdlet gets Azure resources.
Get-AzResource | Format-Table
Name ResourceGroupName ResourceType Location
---- ----------------- ------------ --------
testVM testRG Microsoft.Compute/virtualMachines westus
disk testRG Microsoft.Compute/disks westus
nic testRG Microsoft.Network/networkInterfaces westus
nsg testRG Microsoft.Network/networkSecurityGroups westus
ip testRG Microsoft.Network/publicIPAddresses westus
vnet testRG Microsoft.Network/virtualNetworks westus
testKV otherRG Microsoft.KeyVault/vaults eastus
storage otherResourceGroup Microsoft.Storage/storageAccounts eastus
testVM2 otherResourceGroup Microsoft.Compute/virtualMachines eastus
This command gets all of the resources in the current subscription.
Get-AzResource -ResourceGroupName testRG | Format-Table
Name ResourceGroupName ResourceType Location
---- ----------------- ------------ --------
testVM testRG Microsoft.Compute/virtualMachines westus
disk testRG Microsoft.Compute/disks westus
nic testRG Microsoft.Network/networkInterfaces westus
nsg testRG Microsoft.Network/networkSecurityGroups westus
ip testRG Microsoft.Network/publicIPAddresses westus
vnet testRG Microsoft.Network/virtualNetworks westus
This command gets all of the resources in the resource group "testRG".
Get-AzResource -ResourceGroupName other* | Format-Table
Name ResourceGroupName ResourceType Location
---- ----------------- ------------ --------
testKV otherRG Microsoft.KeyVault/vaults eastus
storage otherResourceGroup Microsoft.Storage/storageAccounts eastus
testVM2 otherResourceGroup Microsoft.Compute/virtualMachines eastus
This command gets all of the resources whose resource group they belong in beings with "other".
Get-AzResource -Name testVM | Format-List
Name : testVM
ResourceGroupName : testRG
ResourceType : Microsoft.Compute/virtualMachines
Location : westus
ResourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testVM
Tags :
Name Value
====== ========
Dept IT
Year 2002
Status Approved
This command gets all of the resources whose resource name is "testVM".
Get-AzResource -Name test* | Format-Table
Name ResourceGroupName ResourceType Location
---- ----------------- ------------ --------
testVM testRG Microsoft.Compute/virtualMachines westus
testKV otherRG Microsoft.KeyVault/vaults eastus
testVM2 otherResourceGroup Microsoft.Compute/virtualMachines eastus
This command gets all of the resources whose resource name begins with "test".
Get-AzResource -ResourceType Microsoft.Compute/virtualMachines | Format-Table
Name ResourceGroupName ResourceType Location
---- ----------------- ------------ --------
testVM testRG Microsoft.Compute/virtualMachines westus
testVM2 otherResourceGroup Microsoft.Compute/virtualMachines eastus
This command gets all of the resources in the current subscriptions that are virtual machines.
Get-AzResource -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testVM
Name : testVM
ResourceGroupName : testRG
ResourceType : Microsoft.Compute/virtualMachines
Location : westus
ResourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testRG/providers/Microsoft.Compute/virtualMachines/testVM
Tags :
Name Value
====== ========
Dept IT
Year 2002
Status Approved
This command gets the resource with the provided resource id, which is a virtual machine called "testVM" in the resource group "testRG".
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with azure
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
When specified, expands the properties of the resource.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The name of the resource(s) to be retrieved. This parameter supports wildcards at the beginning and/or end of the string.
Type: | String |
Aliases: | ResourceName |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The resource group the resource(s) that is retrieved belongs in. This parameter supports wildcards at the beginning and/or end of the string.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Specifies the fully qualified resource ID, as in the following example
/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Compute/virtualMachines
Type: | String |
Aliases: | Id |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
The resource type of the resource(s) to be retrieved. For example, Microsoft.Compute/virtualMachines
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Gets resources that have the specified Azure tag. Enter a hash table with a Name key or Name and Value keys. Wildcard characters are not supported.A "tag" is a name-value pair that you can apply to resources and resource groups. Use tags to categorize your resources, such as by department or cost center, or to track notes or comments about the resources. To add a tag to a resource, use the Tag parameter of the New-AzResource or Set-AzResource cmdlets. To create a predefined tag, use the New-AzTag cmdlet. For help with hash tables in Windows PowerShell, run 'Get-Help about_Hashtables'.
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The key in the tag of the resource(s) to be retrieved.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The value in the tag of the resource(s) to be retrieved.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Azure PowerShell feedback
Azure PowerShell is an open source project. Select a link to provide feedback: