Created
October 19, 2022 15:51
-
-
Save rgpower/6636e5790ebdb4ee33722086715f100d to your computer and use it in GitHub Desktop.
Fetch Azure Policy Metadata, following paged responses
This file contains 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 | |
i=0 | |
done=0 | |
url="https://management.azure.com/providers/Microsoft.PolicyInsights/policyMetadata?api-version=2019-10-01" | |
while [ $done -ne 1 ] | |
do | |
echo az rest --output-file "pm-${i}.json" --url "$url" | |
az rest --output-file "pm-${i}.json" --url "$url" | |
url=$(jq -r '.nextLink' < pm-${i}.json) | |
if [ 'null' -eq $url ] | |
then | |
done=1 | |
fi | |
i=$(($i+1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment