- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the azure resources from the resource group using PowerShell?
To get the available resources from the resource groups using PowerShell, we need to use the Get-AZResource command. Suppose we have the resource group name AnsibleTestRG and we need to retrieve the resources from the resource group, then we will use the below command.
Example
Get-AzResource -ResourceGroupName AnsibleTestRG
To filter the output,
Output
Get-AzResource -ResourceGroupName AnsibleTestRG | Select Name, ResourceType, Location
Output
If there are multiple resource groups in the particular subscription, we can use the below commands to export the resources from the resource group to the CSV file.
Example
$ErrorActionPreference = "Stop" try { Connect-AZAccount Set-AzContext -SubscriptionName 'Your Subscription Name' $rgs = Get-AzResourceGroup foreach ($rg in $rgs.ResourceGroupName) { Write-Output "Checking Resource Group: $rg" Get-AzResource -ResourceGroupName $rg | Select Name, ResourceGroupName, Type, Location | Export-Csv .\AzureResources.csv -Append -Force -NoTypeInformation } } catch { Write-Host "$($_.Exception.Message)" -BackgroundColor DarkRed }
- Related Articles
- How to get the Azure resource group using Azure CLI in PowerShell?
- How to delete the Azure Resource Group using PowerShell?
- How to retrieve the Azure VM resource group using PowerShell?
- How to get the applied azure resource tags using PowerShell?
- How to apply a tag to the azure resource group using PowerShell?
- How to create a new Azure resource group using PowerShell?
- How to check if the Azure resource group is empty or not using PowerShell?
- How to delete all the tags of the azure resource using PowerShell?
- How to get the Azure images available from the specific publisher using PowerShell?
- How to get the Azure VM Size using Azure CLI in PowerShell?
- How to get the Azure VM username using Azure CLI in PowerShell?
- How to get the location of the Azure VM using Azure CLI in PowerShell?
- How to get the available azure VM size using Azure CLI in PowerShell?
- How to get the Azure VM available sizes using PowerShell?
- How to get the installed Azure VM extension using PowerShell?

Advertisements