Get-AzResource

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-AzResource
Get-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.

Get-AzResource

If you want the same output in a tabular structure, you can run the below Azure PowerShell cmdlet.

Get-AzResource | Format-Table

After executing the above command, I got the below output as shown in the screenshot below.

get-azresource powershell

Example-2:

The below Azure PowerShell cmdlet will help you retrieve all the resources under the DEMORG2 resource group.

Get-AzResource -ResourceGroupName DEMORG2 | Format-Table

After executing the above cmdlet, I got the below output, as shown in the screenshot below.

Get-AzResource PowerShell command

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.

 Get-AzResource command

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-Table

After executing the above Azure PowerShell cmdlet, I got the below expected output.

get-azresource powershell

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/TsInfo

After executing the above Azure PowerShell cmdlet, I got the below output.

powershell get-azresource

Video Tutorial

You may also like following the articles below

Wrapping Up

In this Azure PowerShell article, we have discussed the syntax and usage of the Get-AzResource Azure PowerShell cmdlet with examples. Thanks for reading this article !!!

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!