Last active
November 29, 2024 09:41
-
-
Save damienpontifex/7b9aae2cca1a9b750554cc0f39972c97 to your computer and use it in GitHub Desktop.
Access storage by using OAuth token from az cli
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add your use account as "Storage Blob Data Contributor" RBAC to the Access Control of the storage account | |
STORAGE_ACCOUNT=<account-name> | |
STORAGE_ACCESS_TOKEN=$(az account get-access-token --resource https://storage.azure.com/ --query accessToken -o tsv) | |
curl \ | |
-H "Authorization: Bearer $STORAGE_ACCESS_TOKEN" \ | |
-H "x-ms-version: 2018-03-28" \ | |
https://$STORAGE_ACCOUNT.blob.core.windows.net/?comp=list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment