locked
Get Azure Storage Connection String with PowerShell RRS feed

  • Question

  • Hello

    We need to read the connection string of an Azure storage account. Is there an equivalent option to Azure CLI

    az storage account show-connection-string

    in Azure PowerShell? Couldn't find anything in the docs.

    Thanks,
    Manuel

    Wednesday, February 20, 2019 2:47 PM

Answers

  • Hi Manuel, 

    try the following:


    $sa = Get-AzStorageAccount -StorageAccountName $saName -ResourceGroupName $rgName

    $saKey = (Get-AzStorageAccountKey -ResourceGroupName $rgName -Name $saName)[0].Value

    'DefaultEndpointsProtocol=https;AccountName=' + $saName + ';AccountKey=' + $saKey + ';EndpointSuffix=core.windows.net' 

    hth
    Marcin

    • Marked as answer by Manuel1 Thursday, February 21, 2019 7:29 AM
    Wednesday, February 20, 2019 4:38 PM

All replies

  • Hi Manuel, 

    try the following:


    $sa = Get-AzStorageAccount -StorageAccountName $saName -ResourceGroupName $rgName

    $saKey = (Get-AzStorageAccountKey -ResourceGroupName $rgName -Name $saName)[0].Value

    'DefaultEndpointsProtocol=https;AccountName=' + $saName + ';AccountKey=' + $saKey + ';EndpointSuffix=core.windows.net' 

    hth
    Marcin

    • Marked as answer by Manuel1 Thursday, February 21, 2019 7:29 AM
    Wednesday, February 20, 2019 4:38 PM
  • Hello Marcin

    *facepalm*

    Of course! As usual looked for the more complicated solution instead of the easy one :)

    Thank you very much!

    Thursday, February 21, 2019 7:29 AM