In this Azure PowerShell article, we will discuss the syntax and usage of the Get-AzResource Azure PowerShell cmdlet with examples.
Get-AzResource
Get-AzResource is an excellent Azure PowerShell cmdlet that can help you to get a list of all the Azure resources.
Syntax of Get-AzResource
Below is the syntax of the Get-AzResource Azure PowerShell cmdlet.
Get-AzResourceGet-AzResource
[-Name <String>]
[-ResourceType <String>]
[<CommonParameters>]Let’s discuss some examples
Example-1:
You can execute the below Azure PowerShell cmdlet to get the list of resources under your current subscription.
Get-AzResource
Once I executed the above Azure PowerShell cmdlet, I got the expected output, as shown below.

If you want the same output in a tabular structure, you can run the below Azure PowerShell cmdlet.
Get-AzResource | Format-TableAfter executing the above command, I got the below output as shown in the screenshot below.

Example-2:
The below Azure PowerShell cmdlet will help you retrieve all the resources under the DEMORG2 resource group.
Get-AzResource -ResourceGroupName DEMORG2 | Format-TableAfter executing the above cmdlet, I got the below output, as shown in the screenshot below.

Example-3:
You can execute the below Azure PowerShell cmdlet that can help you to retrieve all the Azure resources with the provided name.
Get-AzResource -Name tsinfo | Format-List
After executing the above Azure PowerShell cmdlet, I got the below expected output.

Example-4:
Below Azure PowerShell cmdlet that can help you to get all the resources whose name matches the specified wildcard.
Get-AzResource -Name tsinfo* | Format-TableAfter executing the above Azure PowerShell cmdlet, I got the below expected output.

Example-5:
You can also use the below Azure PowerShell cmdlet to retrieve the Azure resource based on the resource id.
Get-AzResource -ResourceId /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5chu1/resourceGroups/DEMORG1/providers/Microsoft.ServiceBus/namespaces/TsInfoAfter executing the above Azure PowerShell cmdlet, I got the below output.

Video Tutorial
You may also like following the articles below