How to list soft-delete configuration of blob storage using Kusto

Joakim Westin 21 Reputation points
2023-01-10T06:02:14.56+00:00

We have a large number of storage accounts, we want to have a list where we can see the storage accounts and also if the blob service has been configured for soft-delete.

Listing the accounts isn't a problem: resources | where type == "microsoft.storage/storageaccounts" | project id,properties.accessTier, properties.allowSharedKeyAccess, tags.Environment, tags.["Application Family"]

The challenge is how to access the property containerDeleteRetentionPolicy of the type Microsoft.Storage/storageAccounts/blobServices.

I've tried many ways, I've Googled... but no luck so far.

So if anyone has a good example of how to list properties of the blobServices using KUSTO type I'd be very grateful!

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,192 questions
{count} votes

Accepted answer
  1. Alistair Ross 7,466 Reputation points Microsoft Employee
    2023-01-10T10:56:13.56+00:00

    Hi @Joakim Westin

    Unfortunately the answer is you cannot.

    Azure Resource Graph performs API calls for each resource, but not the child resources (which a blob is in this case). Effectively it is running the follow API call and storing the results.

    GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts?api-version=2022-09-01
    

    https://learn.microsoft.com/en-us/rest/api/storagerp/storage-accounts/list?tabs=HTTP

    In this instance you need to call the following API against each storage account

    GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices?api-version=2022-09-01
    

    https://learn.microsoft.com/en-us/rest/api/storagerp/blob-services/list?tabs=HTTP

    Or using PowerShell

    Get-AzStorageAccount  | Get-AzStorageBlobServiceProperty | Select StorageAccountName -ExpandProperty ContainerDeleteRetentionPolicy
    

    Sorry it isn't the answer you are looking for. If you need it available in Resource Graph Explorer, then I encourage you to submit feedback here https://feedback.azure.com/d365community/forum/675ae472-f324-ec11-b6e6-000d3a4f0da0

    kind regards

    Alistair

    2 people found this answer helpful.

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.