In Azure automation runbook I want to connect with storage account and get the context without the account key. I can connect with the storage account key but I don’t want to connect with storage key.
FYI
$Context = New-AzStorageContext -StorageAccountName "cordus6abfsuat001" -UseConnectedAccount
echo $Context
ERROR is "Context cannot be null."
I am expecting to connect with storage account with out the storage account key.
2
Answers
You can use a system-assigned managed identity for you Azure Automation account
Then, in your storage account, you got to:
There you can give the Role Contributor for your Automation Account Identity
Hoppe This helps!
You can alternatively use Connection string and get the context as below and I followed Microsoft-Document:
XX is the Connection string of Storage account.
Output:
You can also get it with uisng SAS token as below:
Output: