Skip to content

Instantly share code, notes, and snippets.

@sozercan
Last active June 3, 2024 10:58
Show Gist options
  • Save sozercan/6ee1521853b2668aad0450ff6c3281ee to your computer and use it in GitHub Desktop.
Save sozercan/6ee1521853b2668aad0450ff6c3281ee to your computer and use it in GitHub Desktop.
script to disable local auth for openai
#!/bin/bash
subscription_id="<insert subscription id>"
resource_group="<insert resource group>"
endpoints=("<insert endpoint1>" "<insert endpoint2>" "...")
# Define the base URI for the Azure Management API
base_uri="https://management.azure.com/subscriptions/$subscription_id/resourceGroups/$resource_group/providers/Microsoft.CognitiveServices/accounts"
# Define the API version
api_version="2021-10-01"
# Define the body of the request
read -r -d '' body <<'EOF'
{
"properties": {
"disableLocalAuth": true
}
}
EOF
# Loop through each endpoint and execute the Azure CLI command
for endpoint in "${endpoints[@]}"; do
echo "Patching $endpoint..."
az rest --method patch --uri "$base_uri/$endpoint?api-version=$api_version" --body "$body"
done
echo "Script execution completed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment