Skip to content

Instantly share code, notes, and snippets.

@takekazuomi
Last active June 12, 2020 05:40
Show Gist options
  • Save takekazuomi/fb1b1ab6fed3b051564f5045e1a07d1d to your computer and use it in GitHub Desktop.
Save takekazuomi/fb1b1ab6fed3b051564f5045e1a07d1d to your computer and use it in GitHub Desktop.
create user invitation for Azure Static Web Apps
#!/bin/bash
SUBSCRIPTION_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RESOURCE_GROUP_NAME=foobar-rg
STATIC_SITE_NAME=foobar-swa
DOMAIN=purple-apple-0611x5701.azurestaticapps.net
USER_DETAILS=foobar@costoco.com
cat << EOJ > properties.json
{
"properties": {
"provider": "aad",
"domain": "${DOMAIN}",
"roles": "reader",
"userDetails": "${USER_DETAILS}",
"numHoursToExpiration": 1
}
}
EOJ
az rest --method post --headers "Content-Type=application/json" \
--uri "/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP_NAME}/providers/Microsoft.Web/staticSites/${STATIC_SITE_NAME}/createUserInvitation?api-version=2019-12-01-preview" \
--body @properties.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment