Xoce2021
Xoce2021

Reputation: 1

Create a script to collect StorageAccount options in Azure

a query can be obtained by reporting the properties (Diagnostic Settings) of the Azure Storage Account services, which are blob properties, file properties, table properties, queue properties.

What I use to get 1 for one is as follows:

$ storageAccountContext = (Get-AzStorageAccount -Name storage1 -ResourceGroupName rg-gruop1) .Context

Get-AzStorageServiceProperty -ServiceType Blob -Context $ storageAccountContext

Get-AzStorageServiceProperty -ServiceType File -Context $ storageAccountContext

Get-AzStorageServiceProperty -ServiceType Table -Context $ storageAccountContext

Get-AzStorageServiceProperty -ServiceType Queue -Context $ storageAccountContext

enter image description here

Upvotes: 0

Views: 142

Answers (1)

Hugo Barona
Hugo Barona

Reputation: 1398

You just need to get all storage accounts in your subscription, or if you want just accounts in a given resource group, you can use the *-ResourceGroupName * parameter, and then you iterate them using a simple foreach.

$accounts = Get-AzStorageAccount
foreach($account in $accounts){
   (...)
}

Upvotes: 1

Related Questions