Get-AzResource
Retrieves information about Azure resources.
SYNOPSIS
Retrieves information about Azure resources.
SYNTAX
Get-AzResource
[-ApiVersion <String>]
[-AllowWildcardTheme <SwitchParameter>]
[-ResourceGroupName <String>]
[-ResourceId <String>]
[-ResourceName <String>]
[-ResourceType <String>]
[-SubscriptionId <String>]
[-TenantId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
Get-AzResource
-ResourceId <String>
[-ApiVersion <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
DESCRIPTION
The Get-AzResource cmdlet retrieves information about Azure resources. You can use this cmdlet to retrieve all resources in a subscription, or to retrieve resources by resource group, resource name, or resource type.
PARAMETERS
| Name | Type | Description |
|---|---|---|
-ApiVersion |
String | Specifies the API version of the resource provider to use for the request. |
-AllowWildcardTheme |
SwitchParameter | Indicates that the cmdlet supports wildcard characters in parameter values. This parameter is not typically used directly. |
-ResourceGroupName |
String | Specifies the name of the resource group. |
-ResourceId |
String | Specifies the ID of the resource. This is a fully qualified resource ID. |
-ResourceName |
String | Specifies the name of the resource. |
-ResourceType |
String | Specifies the type of the resource. For example, 'Microsoft.Storage/storageAccounts' or 'Microsoft.Web/sites'. |
-SubscriptionId |
String | Specifies the ID of the subscription to which the resources belong. |
-TenantId |
String | Specifies the ID of the tenant to which the resources belong. |
-DefaultProfile |
IAzureContextContainer | The credentials, account, tenant, and subscription that are used for communication with Azure. |
-WhatIf |
SwitchParameter | Runs the cmdlet in simulation mode. The cmdlet does not run the command and will list what would happen if the command were run. |
-Confirm |
SwitchParameter | Runs the cmdlet with confirmation. The cmdlet prompts you to confirm before running the command. |
EXAMPLES
Example 1: Get all resources in the current subscription
Get-AzResource
Example 2: Get all resources in a specific resource group
Get-AzResource -ResourceGroupName "myResourceGroup"
Example 3: Get a specific resource by its ID
Get-AzResource -ResourceId "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"
Example 4: Get all storage accounts in a resource group
Get-AzResource -ResourceGroupName "myResourceGroup" -ResourceType "Microsoft.Storage/storageAccounts"
Example 5: Get a specific storage account by name and resource type
Get-AzResource -ResourceGroupName "myResourceGroup" -ResourceType "Microsoft.Storage/storageAccounts" -ResourceName "mystorageaccount"
INPUTS
None. You can pipe to this cmdlet.
OUTPUTS
Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSAzureResource