Delen via


Aanmelden met de Azure CLI

Op deze pagina wordt uitgelegd hoe u de Azure CLI gebruikt om u aan te melden bij Azure Databricks met een gebruikersaccount of een service-principal voor Microsoft Entra ID.

Aanmelden als gebruiker

Volg deze stappen om de Azure CLI te gebruiken om u met een gebruikersaccount aan te melden bij Azure Databricks.

  1. Uw Azure-abonnements-id ophalen:

    • Azure Portal: In uw Azure Databricks-werkruimte, klik op uw gebruikersnaam >Azure Portal>Overzicht. Kopieer de abonnements-id.
    • Azure CLI: Voer de volgende opdracht uit en vervang deze adb-0000000000000000.0.azuredatabricks.net door uw werkruimte-URL (zonder https://). De abonnements-id wordt weergegeven na /subscriptions/ in de uitvoer.
    az databricks workspace list --query "[?workspaceUrl==\`adb-0000000000000000.0.azuredatabricks.net\`].{id:id}" -o tsv
    
    # /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Databricks/workspaces/my-ws
    

    Als u The subscription of '<subscription-id>' doesn't exist in cloud 'AzureCloud' ziet, haalt u uw tenant-id op door curl -v <per-workspace-URL>/aad/auth uit te voeren (zoek de id in de location respons) of bekijk Abonnements- en tenant-id's ophalen. Meld u vervolgens aan met: az login -t <tenant-id>

  2. Meld u aan bij Azure en volg de instructies op het scherm:

    az login
    
  3. Stel het juiste abonnement in:

    az account set -s <subscription-id>
    

Aanmelden als een Microsoft Entra ID-service-principal

Als u zich wilt aanmelden met een Microsoft Entra ID-service-principal, verzamelt u het volgende uit uw Microsoft Entra ID-toepassing:

  • Tenant-id: Directory-id (tenant)

  • Client ID: Applicatie (client) ID

  • Clientgeheim: De geheime waarde

  • Abonnements-id: Haal dit op via De Azure-portal (overzichtspagina voor werkruimten) of via de CLI:

    az databricks workspace list --query "[?workspaceUrl==\`adb-0000000000000000.0.azuredatabricks.net\`].{id:id}" -o tsv
    
    # /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Databricks/workspaces/my-ws
    

Gebruik de waarden om u aan te melden:

az login \
--service-principal \
-t <Tenant-ID> \
-u <Client-ID> \
-p <Client-secret>

Stel vervolgens uw abonnement in:

az account set -s <subscription-id>