fabric-auth
Skill1 starsChanged 56 days agoMITView on GitHub
Use when authenticating to Microsoft Fabric APIs — getting 401 Unauthorized errors, choosing token audience/scope for Fabric REST, Power BI REST, OneLake, Warehouse/SQL, KQL, XMLA, or Azure ARM, or running `az login` / `az account get-access-token` / `az rest` for Fabric. Covers the full token-audience table, the OneLake-only `storage.azure.com/.default` requirement, `az login` flow variants (--allow-no-subscriptions, --use-device-code, SPN cert, managed identity), `az rest --resource` requirement (Fabric URL is not a built-in Azure endpoint), JWT decoding for 401 debugging, and why using the wrong audience is the #1 cause of 401s.
In this repository62 other files it gives its agents.
- claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- author-skillSkill
- drift-auditSkill
- drift-handoffSkill
- drift-updateSkill
- test-skillSkill
- triageSkill
- fabric-activatorSkill
- fabric-ai-functionsSkill
- fabric-catalog-governanceSkill
- fabric-cicdSkill
- fabric-cliSkill
- fabric-copy-jobSkill
- fabric-data-agentSkill
- fabric-databaseSkill
- fabric-dataflowSkill
- fabric-data-pipelineSkill
- fabric-deployment-pipelinesSkill
- fabric-error-handlingSkill
- fabric-eventhouseSkill
- fabric-event-schema-setSkill
- fabric-eventstreamSkill
- fabric-gotchasSkill
- fabric-graphSkill
- fabric-mirroringSkill
- fabric-mlvSkill
- fabric-ontologySkill
- fabric-operations-agentSkill
- fabric-realtime-dashboardSkill
- fabric-rest-apiSkill
- fabric-securitySkill
- fabric-semantic-model-ai-instructionsSkill
- fabric-semantic-model-auditSkill
- fabric-spark-monitoringSkill
- fabric-sparkSkill
- fabric-tmdl-apiSkill
- fabric-tmdlSkill
- fabric-variable-librarySkill
- fabric-warehouse-monitoringSkill
- fabric-warehouseSkill
- learnSkill
- pbid-tom-liveSkill
- pbip-project-structureSkill
- pbir-bookmarksSkill
- pbir-cliSkill
- pbir-conditional-formattingSkill
- pbir-filtersSkill
- pbir-pagesSkill
- pbir-report-workflowSkill
- pbir-themesSkill
- pbir-visual-jsonSkill
- powerbi-report-authoringSkill
- powerbi-report-designSkill
- linkedin-highlightsSkill
- msix-packagingSkill
- code-reviewSkill
- commitSkill
- find-sessionSkill
- landSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
All Fabric operations require Microsoft Entra ID OAuth 2.0 bearer tokens.
- Distinctive: line 60
When you get an unexpected 401, decode the JWT to see what audience the token actually has:
- Very specific: line 71
When connecting via sqlcmd, ODBC drivers, or any TDS client:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Fabric authentication & token audiences
All Fabric operations require Microsoft Entra ID OAuth 2.0 bearer tokens. Using the wrong audience is the #1 cause of 401 errors.
| Access Target | Token Audience / Scope |
| Fabric REST API | https://api.fabric.microsoft.com/.default |
| Power BI REST API (refresh, data sources, permissions, DAX) | https://analysis.windows.net/powerbi/api/.default |
| OneLake (DFS/Blob) | https://storage.azure.com/.default |
| Cosmos DB in Fabric (NoSQL data plane) | https://cosmos.azure.com, as --resource or a notebook's getToken("https://cosmos.azure.com/"); the /.default scope form is untested (2026-10-01) |
| Warehouse / SQL Endpoint / SQL Database (TDS) | https://database.windows.net/.default |
| KQL / Kusto | https://kusto.kusto.windows.net/.default |
| XMLA Endpoint | https://analysis.windows.net/powerbi/api/.default |
| Azure Resource Management | https://management.azure.com/.default |
az login
az account get-access-token --resource https://api.fabric.microsoft.com # Fabric REST
az account get-access-token --resource https://database.windows.net # SQL / TDS
az account get-access-token --resource https://analysis.windows.net/powerbi/api # Power BICritical: OneLake ONLY accepts https://storage.azure.com/.default — using https://datalake.azure.net/ will fail.
az login flow variants
az login --allow-no-subscriptions --tenant <tid> # Fabric tenant with no Azure subscription
az login --use-device-code --tenant <tid> # headless / SSH / no-browser
az login --service-principal -u <appId> -p <secret> --tenant <tid> # CI/CD with SPN secret
az login --service-principal -u <appId> --certificate /path/cert.pem --tenant <tid> # SPN cert (preferred — no secret to rotate)
az login --identity # system-assigned managed identity
az login --identity --username <clientId> # user-assigned managed identityWithout --allow-no-subscriptions, Fabric-only tenants (no Azure subscription attached) get a confusing "No subscriptions found" error before any Fabric call runs.
az rest --resource requirement
api.fabric.microsoft.com is not a built-in Azure cloud endpoint, so az rest cannot derive the audience from the URL. Always pass --resource:
az rest --method get \
--resource "https://api.fabric.microsoft.com" \
--url "https://api.fabric.microsoft.com/v1/workspaces"Without --resource, you get "Can't derive appropriate Azure AD resource from --url" — the single most common az rest Fabric error.
Decoding a token to debug 401s
When you get an unexpected 401, decode the JWT to see what audience the token actually has:
TOKEN=$(az account get-access-token --resource https://api.fabric.microsoft.com --query accessToken -o tsv)
echo "$TOKEN" | cut -d'.' -f2 | base64 -d 2>/dev/null | jq .Compare the aud claim against the table above. Other useful claims: exp (Unix expiry), oid (principal object ID), tid (tenant ID).
TDS connection essentials (Warehouse / SQL Database)
When connecting via sqlcmd, ODBC drivers, or any TDS client:
| Parameter | Value |
| Port | 1433 (TCP, must be open outbound) |
Initial Catalog / Database | Item display name (NOT the FQDN) |
| Authentication | Microsoft Entra ID only — SQL auth is not supported |
| Encryption | Encrypt=Yes required |
| Token audience | https://database.windows.net/.default |
| MARS | Not supported — remove MultipleActiveResultSets from connection strings (or set to false) |
Gotcha: Login failed... database not found usually means the connection string passed the FQDN as Initial Catalog instead of the workspace item display name. Allow *.datawarehouse.fabric.microsoft.com and *-pbidedicated.windows.net through any outbound firewall.
Reference
- Microsoft Learn: Authenticate to Azure using Azure CLI
- Microsoft Learn: MSAL overview
- Microsoft Learn: Microsoft Entra authentication for Fabric SQL
- Comprehensive MS Learn link bundle (concept / Fabric REST auth / Azure CLI / OAuth flows / MSAL by language / SPN & managed identity / scopes & claims / Fabric-specific): references/REFERENCE.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

