Search code examples
azureazure-storage

How to get azure storage encryption status


I am trying to get Azure Storage's encryption status from command line or programatically but could not find any relevant cmdlet(https://learn.microsoft.com/en-us/powershell/module/azure.storage/get-azurestorageserviceproperty?view=azurermps-6.13.0). I can check that manually from portal like this

enter image description here

is it avilable to check through any command line or we have to check only through portal ?


Solution

  • You could use the command below, make sure you have installed the Az module.

    (Get-AzResource -ResourceGroupName <group-name> -ResourceType Microsoft.Storage/storageAccounts -Name <storageaccount-name>).Properties.encryption | ConvertTo-Json
    

    If the Encryption type is Microsoft-managed keys, the keySource will be Microsoft.Storage.

    enter image description here

    If the Encryption type is Customer-managed keys, the keySource will be Microsoft.Keyvault, keyvaultproperties will include the properties of the keyvault key you configured.

    enter image description here