Skip to content

Instantly share code, notes, and snippets.

@nbx3
Created April 2, 2019 15:20
Show Gist options
  • Save nbx3/28ecd236e60dc86e4949c8932d63982f to your computer and use it in GitHub Desktop.
Save nbx3/28ecd236e60dc86e4949c8932d63982f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
OFFSET=${1:-1d}
SERVICE_FILTER="ccd-|sscs-|probate-|cmc-|div-|finrem-|fees-|bulk-"
TMP=$(mktemp)
az group list | jq -r '.[] | (.name)' | egrep ${SERVICE_FILTER} > ${TMP}
while read line
do
az monitor activity-log list \
-g ${line} \
--offset ${OFFSET} \
| jq '.[] | select(.operationName.value | contains("Microsoft.Web/sites/slots/slotsswap/action"))' \
| jq '{resourceGroup, eventTimestamp, operationName: .operationName.value, Status: .status.value}'
done < ${TMP}
rm ${TMP}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment