I am new to writing Azure Resource Manager templates; I have a requirement where I need to retrieve my Azure Storage Account Connection String. I am able to retrieve it's access key using [listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value]
where storageAccountId
is [resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]
but I'm unable to do so for the connection string(primary).
Now, my question is like we have listKeys
function to retrieve the access keys, do we have some system function for retrieving connection string also? Or do we need to concatenate and create the connection string? I have the values for Storage Account Name & Resource Group Name. How can I do this using ARM?
According to my research, Azure ARM template does not provide the function that we can use to list storage account connection string. We just can ARM template function to list access key(listkeys
) list account SAS token(listAccountSas
) or list service SAS token(listServiceSas
). For more details, please refer to the document.
So if you want to get storage account connection string, I suggest you use Azure ARM template function concat
to combine the connection string. For example
"outputs": {
"storageAccountConnectionString": {
"type": "string",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(resourceId(parameters('resourceGroupName'),'Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2019-04-01').keys[0].value,';EndpointSuffix=core.windows.net')]"
},
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With