#!/bin/bash # Refresh Fabric API token and write it to .env set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" ENV_FILE="$PROJECT_DIR/.env" echo "Refreshing Microsoft Fabric API token..." TOKEN=$(az account get-access-token --resource "https://api.fabric.microsoft.com" --query accessToken -o tsv) TENANT_ID=$(az account show --query tenantId -o tsv) ACCOUNT_NAME=$(az account show --query user.name -o tsv) SUBSCRIPTION=$(az account show --query name -o tsv) EXPIRES=$(az account get-access-token --resource "https://api.fabric.microsoft.com" --query expiresOn -o tsv) cat > "$ENV_FILE" <