Search code examples
azureazure-storageazure-powershellazure-storage-account

How to get storage account id given storage account name and resource group using azure powershell command?


I am a beginner at azure-CLI.

I just wanted to find out the storage account id.

I have a resource group named 'group2' and a storage account with the name 'storageacc1'.

I tried the below PowerShell command to get storage account details :

Get-AzStorageAccount -ResourceGroupName "group2" -AccountName "storageacc11"

In the return I got StorageAccountName,ResourceGroupName,PrimaryLocation, SkuName,Kind, AccessTier,CreationTime,ProvisioningState,EnableHttpsTrafficOnly,LargeFileShares.

how to get a storage account id?


Solution

  • Just use the code blow:

    $s = Get-AzStorageAccount -ResourceGroupName "xx" -AccountName "xx"
    
    $s.Id