Files
sk-az-tools/scripts/get-full-app-info.sh

29 lines
614 B
Bash
Executable File

#!/usr/bin/env bash
APP_NAME="$1"
if [[ -z "$APP_NAME" ]]; then
echo "Usage: $0 <app-name>"
exit 1
fi
APP_ID=$(az ad app list --display-name "$APP_NAME" --query "[0].appId" -o tsv)
if [[ -z "$APP_ID" ]]; then
echo "Error: Application '$APP_NAME' not found."
exit 1
fi
TENANT_ID=$(az account show --query tenantId -o tsv)
if [[ -z "$TENANT_ID" ]]; then
echo "Error: Failed to resolve tenantId from current Azure CLI context."
exit 1
fi
az ad app show --id "$APP_ID" -o json
cat <<EOF
export const config = {
"appName": "$APP_NAME",
"tenantId": "$TENANT_ID",
"clientId": "$APP_ID"
};
EOF