Initial setup: Fabric API helper scripts and project config

- CLAUDE.md with API reference, auth setup, and workspace details
- scripts/fabric-api.sh: helper functions for Fabric REST API
- scripts/refresh-token.sh: token refresh and .env writer
- .gitignore: protect .env and .omc/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
TheTrustedAdvisor 2026-03-11 07:51:50 +01:00
commit 9ce0527ac5
4 changed files with 166 additions and 0 deletions

33
scripts/refresh-token.sh Executable file
View file

@ -0,0 +1,33 @@
#!/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" <<EOF
# Microsoft Fabric API Configuration
# Auto-generated by refresh-token.sh - DO NOT COMMIT
# Token expires: $EXPIRES
FABRIC_TOKEN=$TOKEN
FABRIC_TENANT_ID=$TENANT_ID
FABRIC_ACCOUNT=$ACCOUNT_NAME
FABRIC_SUBSCRIPTION=$SUBSCRIPTION
FABRIC_API_BASE=https://api.fabric.microsoft.com/v1
EOF
echo "Token written to .env"
echo " Tenant: $TENANT_ID"
echo " Account: $ACCOUNT_NAME"
echo " Subscription: $SUBSCRIPTION"
echo " Expires: $EXPIRES"