need to pull inventory of tags-properties fields of storage account

Durga Venutejaswi Kandukuri 26 Reputation points
2021-06-01T08:30:13.997+00:00

HI Team,

I need help to get the status(fields data into a of Blob service, Networking and security of each & every storage account (2-3 storage accounts were created)of each & every resource group(15 RG's i have) of a subscription. and below are the details and snapshot for better understanding where i have create and testing in a free trail account along with the expected result snapshot.

**Blob service

----------------
**
Blob public access
Blob soft delete
Container soft delete

Security
--------

Secure transfer required

**Networking

----------
**
Allow access from
Number of private endpoint connections

From portal and expected result is as below:1: /api/attachments/101319-sa-result.jpg?platform=QnA

Thanks in Advance,
Durga.K

102065-sa1.jpg102066-sa-expected-result.jpg

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,521 questions
0 comments No comments
{count} votes

Accepted answer
  1. deherman-MSFT 38,021 Reputation points Microsoft Employee Moderator
    2021-06-02T18:38:49.547+00:00

    @Durga Venutejaswi Kandukuri

    Container soft delete is in preview, as such there is not a way to easily fetch this through scripting. As this feature is further developed I expect you will be able to more easily obtain this information. For the remainder of the information you can use the below PowerShell to get all the information for your subscription:

    $context = Get-AzContext  
      
    $storageAccounts = Get-AzResource -ResourceType 'Microsoft.Storage/storageAccounts'   
      
    [System.Collections.ArrayList]$saUsage = New-Object -TypeName System.Collections.ArrayList  
      
     foreach ($storageAccount in $storageAccounts) {  
      
      
                $StorageAccountDetails = [ordered]@{  
                        SubscriptionName = $context.Subscription.Name  
                        SubscrpitionID = $context.Subscription.Id  
                        StorageAccountName = $storageAccount.Name  
                        ResourceGroup = $storageAccount.ResourceGroupName  
                        Location = $storageAccount.Location  
    					BlobPublicAccess = (Get-AzStorageAccount -ResourceGroupName $storageAccount.ResourceGroupName -Name $storageAccount.Name).AllowBlobPublicAccess  
    					BlobSoftDelete = (Get-AzStorageBlobServiceProperty -ResourceGroupName $storageAccount.ResourceGroupName -StorageAccountName $storageAccount.Name).DeleteRetentionPolicy.Enabled  
    					SecureTransferRequired = (Get-AzStorageAccount -ResourceGroupName $storageAccount.ResourceGroupName -Name $storageAccount.Name).EnableHttpsTrafficOnly  
    					AllowAccessFrom = (Get-AzStorageAccountNetworkRuleSet -ResourceGroupName $storageAccount.ResourceGroupName -AccountName $storageAccount.Name).DefaultAction  
    					PrivateEndpoints = (Get-AzStorageAccountNetworkRuleSet -ResourceGroupName $storageAccount.ResourceGroupName -AccountName $storageAccount.Name).VirtualNetworkRules  
      
    			  }  
                 $saUsage.add((New-Object psobject -Property $StorageAccountDetails))  | Out-Null     
    }  
    $saUsage | Export-Csv -Path C:\Users\username\test.csv -NoTypeInformation  
    

    Please check to see if this works for you. If you have further questions or issues please let us know.

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.