In deze sectie wordt uitgelegd hoe u CLI kunt instellen als u Azure AD als uw identiteits beheer service gebruikt en CLI gebruikt op een Windows-computer.This section walks you through setting up CLI if you're using Azure AD as your identity management service, and are using CLI on a Windows machine.
Verbinding maken met Azure Stack hubConnect to Azure Stack Hub
Als u de ASDK gebruikt, vertrouwt u het CA-basis certificaat van de Azure Stack hub.If you are using the ASDK, trust the Azure Stack Hub CA root certificate. Zie het certificaat vertrouwenvoor instructies.For instruction, see Trust the certificate.
Registreer uw Azure Stack hub-omgeving door de opdracht uit te voeren az cloud register
.Register your Azure Stack Hub environment by running the az cloud register
command.
Registreer uw omgeving.Register your environment. Gebruik de volgende para meters bij het uitvoeren van az cloud register
:Use the following parameters when running az cloud register
:
WaardeValue |
VoorbeeldExample |
BeschrijvingDescription |
OmgevingsnaamEnvironment name |
AzureStackUserAzureStackUser |
Gebruiken AzureStackUser voor de gebruikers omgeving.Use AzureStackUser for the user environment. Als u operator bent, geeft u op AzureStackAdmin .If you're operator, specify AzureStackAdmin . |
Resource Manager-eindpuntResource Manager endpoint |
https://management.contoso.onmicrosoft.com |
De ResourceManagerUrl in de ASDK is: https://management.contoso.onmicrosoft.com/ de ResourceManagerUrl in geïntegreerde systemen is: https://management.<region>.<fqdn>/ Als u een vraag hebt over het geïntegreerde systeem eindpunt, neemt u contact op met uw Cloud operator.The ResourceManagerUrl in the ASDK is: https://management.contoso.onmicrosoft.com/ The ResourceManagerUrl in integrated systems is: https://management.<region>.<fqdn>/ If you have a question about the integrated system endpoint, contact your cloud operator. |
OpslageindpuntStorage endpoint |
local.contoso.onmicrosoft.comlocal.contoso.onmicrosoft.com |
local.azurestack.external is voor de ASDK.local.azurestack.external is for the ASDK. Gebruik voor een geïntegreerd systeem een eind punt voor uw systeem.For an integrated system, use an endpoint for your system. |
Achtervoegsel voor sleutel kluisKeyvault suffix |
. vault.contoso.onmicrosoft.com.vault.contoso.onmicrosoft.com |
.vault.local.azurestack.external is voor de ASDK..vault.local.azurestack.external is for the ASDK. Gebruik voor een geïntegreerd systeem een eind punt voor uw systeem.For an integrated system, use an endpoint for your system. |
Resource-ID van de Active Directory-grafiek van het eind puntEndpoint active directory graph resource ID |
https://graph.windows.net/ |
De resource-id voor Active Directory.The Active Directory resource ID. |
az cloud register `
-n <environmentname> `
--endpoint-resource-manager "https://management.<region>.<fqdn>" `
--suffix-storage-endpoint "<fqdn>" `
--suffix-keyvault-dns ".vault.<fqdn>" `
--endpoint-active-directory-graph-resource-id "https://graph.windows.net/"
U vindt een verwijzing voor de registratie opdracht in de Azure cli-referentie documentatie.You can find a reference for the register command in the Azure CLI reference documentation.
Stel de actieve omgeving in met behulp van de volgende opdrachten.Set the active environment by using the following commands.
az cloud set -n <environmentname>
Werk uw omgevings configuratie bij om het API-versie Profiel van de Azure Stack hub te gebruiken.Update your environment configuration to use the Azure Stack Hub specific API version profile. Voer de volgende opdracht uit om de configuratie bij te werken:To update the configuration, run the following command:
az cloud update --profile 2019-03-01-hybrid
Meld u aan bij uw Azure Stack hub-omgeving met behulp van de az login
opdracht.Sign in to your Azure Stack Hub environment by using the az login
command.
U kunt zich aanmelden bij de Azure Stack hub-omgeving met behulp van uw gebruikers referenties of met een Service-Principal (SPN) die u hebt ontvangen van uw Cloud operator.You can sign in to the Azure Stack Hub environment using your user credentials, or with a service principal (SPN) provided to you by your cloud operator.
Meld u aan als een gebruiker:Sign in as a user:
U kunt de gebruikersnaam en het wachtwoord rechtstreeks opgeven met de opdracht az login
of verifiëren met behulp van een browser.You can either specify the username and password directly within the az login
command, or authenticate by using a browser. U moet dit doen als voor uw account multi-factor Authentication is ingeschakeld:You must do the latter if your account has multi-factor authentication enabled:
az login -u "user@contoso.onmicrosoft.com" -p 'Password123!' --tenant contoso.onmicrosoft.com
Notitie
Als voor uw gebruikers account multi-factor Authentication is ingeschakeld, gebruikt u de az login
opdracht zonder de para meter op te geven -u
.If your user account has multi-factor authentication enabled, use the az login
command without providing the -u
parameter. Als u deze opdracht uitvoert, hebt u een URL en een code die u moet gebruiken om te verifiëren.Running this command gives you a URL and a code that you must use to authenticate.
Aanmelden als service- Principal:Sign in as a service principal:
Voordat u zich aanmeldt, maakt u een Service-Principal via de Azure Portal of CLI en wijst u deze toe aan een rol.Before you sign in, create a service principal through the Azure portal or CLI and assign it a role. Meld u nu aan met de volgende opdracht:Now, sign in by using the following command:
az login `
--tenant <Azure Active Directory Tenant name. `
For example: myazurestack.onmicrosoft.com> `
--service-principal `
-u <Application Id of the Service Principal> `
-p <Key generated for the Service Principal>
Controleer of uw omgeving juist is ingesteld en of uw omgeving de actieve Cloud is.Verify that your environment is set correctly and that your environment is the active cloud.
az cloud list --output table
U ziet dat uw omgeving wordt weer gegeven en IsActive is true
.You should see that your environment is listed and IsActive is true
. Bijvoorbeeld:For example:
IsActive Name Profile
---------- ----------------- -----------------
False AzureCloud 2019-03-01-hybrid
False AzureChinaCloud latest
False AzureUSGovernment latest
False AzureGermanCloud latest
True AzureStackUser 2019-03-01-hybrid
De connectiviteit testenTest the connectivity
Als alles is ingesteld, gebruikt u CLI om resources te maken in Azure Stack hub.With everything set up, use CLI to create resources within Azure Stack Hub. U kunt bijvoorbeeld een resource groep voor een app maken en een virtuele machine toevoegen.For example, you can create a resource group for an app and add a VM. Gebruik de volgende opdracht om een resource groep te maken met de naam ' MyResourceGroup ':Use the following command to create a resource group named "MyResourceGroup":
az group create -n MyResourceGroup -l local
Als de resource groep is gemaakt, voert de vorige opdracht de volgende eigenschappen van de zojuist gemaakte resource uit:If the resource group is created successfully, the previous command outputs the following properties of the newly created resource:

In deze sectie wordt u begeleid bij het instellen van CLI als u Active Directory Federated Services (AD FS) gebruikt als uw identiteits beheer service en gebruikmaakt van CLI op een Windows-computer.This section walks you through setting up CLI if you're using Active Directory Federated Services (AD FS) as your identity management service, and are using CLI on a Windows machine.
Verbinding maken met Azure Stack hubConnect to Azure Stack Hub
Als u de ASDK gebruikt, vertrouwt u het CA-basis certificaat van de Azure Stack hub.If you are using the ASDK, trust the Azure Stack Hub CA root certificate. Zie het certificaat vertrouwenvoor instructies.For instruction, see Trust the certificate.
Registreer uw Azure Stack hub-omgeving door de opdracht uit te voeren az cloud register
.Register your Azure Stack Hub environment by running the az cloud register
command.
Registreer uw omgeving.Register your environment. Gebruik de volgende para meters bij het uitvoeren van az cloud register
:Use the following parameters when running az cloud register
:
WaardeValue |
VoorbeeldExample |
BeschrijvingDescription |
OmgevingsnaamEnvironment name |
AzureStackUserAzureStackUser |
Gebruiken AzureStackUser voor de gebruikers omgeving.Use AzureStackUser for the user environment. Als u operator bent, geeft u op AzureStackAdmin .If you're operator, specify AzureStackAdmin . |
Resource Manager-eindpuntResource Manager endpoint |
https://management.local.azurestack.external |
De ResourceManagerUrl in de ASDK is: https://management.local.azurestack.external/ de ResourceManagerUrl in geïntegreerde systemen is: https://management.<region>.<fqdn>/ Als u een vraag hebt over het geïntegreerde systeem eindpunt, neemt u contact op met uw Cloud operator.The ResourceManagerUrl in the ASDK is: https://management.local.azurestack.external/ The ResourceManagerUrl in integrated systems is: https://management.<region>.<fqdn>/ If you have a question about the integrated system endpoint, contact your cloud operator. |
OpslageindpuntStorage endpoint |
lokaal. azurestack. externallocal.azurestack.external |
local.azurestack.external is voor de ASDK.local.azurestack.external is for the ASDK. Gebruik voor een geïntegreerd systeem een eind punt voor uw systeem.For an integrated system, use an endpoint for your system. |
Achtervoegsel voor sleutel kluisKeyvault suffix |
. kluis. local. azurestack. external.vault.local.azurestack.external |
.vault.local.azurestack.external is voor de ASDK..vault.local.azurestack.external is for the ASDK. Gebruik voor een geïntegreerd systeem een eind punt voor uw systeem.For an integrated system, use an endpoint for your system. |
Document eind punt alias van VM-installatie kopie-VM image alias doc endpoint- |
https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json |
De URI van het document, dat VM-afbeeldings aliassen bevat.URI of the document, which contains VM image aliases. Zie het eind punt van de alias van de virtuele machine instellenvoor meer informatie.For more info, see Set up the virtual machine alias endpoint. |
az cloud register -n <environmentname> --endpoint-resource-manager "https://management.local.azurestack.external" --suffix-storage-endpoint "local.azurestack.external" --suffix-keyvault-dns ".vault.local.azurestack.external" --endpoint-vm-image-alias-doc <URI of the document which contains VM image aliases>
Stel de actieve omgeving in met behulp van de volgende opdrachten.Set the active environment by using the following commands.
az cloud set -n <environmentname>
Werk uw omgevings configuratie bij om het API-versie Profiel van de Azure Stack hub te gebruiken.Update your environment configuration to use the Azure Stack Hub specific API version profile. Voer de volgende opdracht uit om de configuratie bij te werken:To update the configuration, run the following command:
az cloud update --profile 2019-03-01-hybrid
Notitie
Als u een versie van Azure Stack hub hebt vóór de 1808-build, moet u het API-versie profiel 2017-03-09-profile gebruiken in plaats van het API -versie profiel 2019-03-01-Hybrid.If you're running a version of Azure Stack Hub before the 1808 build, you must use the API version profile 2017-03-09-profile rather than the API version profile 2019-03-01-hybrid. U moet ook een recente versie van de Azure CLI gebruiken.You also need to use a recent version of the Azure CLI.
Meld u aan bij uw Azure Stack hub-omgeving met behulp van de az login
opdracht.Sign in to your Azure Stack Hub environment by using the az login
command. U kunt zich aanmelden bij de Azure Stack hub-omgeving als gebruiker of als service- Principal.You can sign in to the Azure Stack Hub environment either as a user or as a service principal.
Meld u aan als een gebruiker:Sign in as a user:
U kunt de gebruikersnaam en het wachtwoord rechtstreeks opgeven met de opdracht az login
of verifiëren met behulp van een browser.You can either specify the username and password directly within the az login
command, or authenticate by using a browser. U moet dit doen als voor uw account multi-factor Authentication is ingeschakeld:You must do the latter if your account has multi-factor authentication enabled:
az cloud register -n <environmentname> --endpoint-resource-manager "https://management.local.azurestack.external" --suffix-storage-endpoint "local.azurestack.external" --suffix-keyvault-dns ".vault.local.azurestack.external" --endpoint-vm-image-alias-doc <URI of the document which contains VM image aliases> --profile "2019-03-01-hybrid"
Notitie
Als voor uw gebruikers account multi-factor Authentication is ingeschakeld, gebruikt u de az login
opdracht zonder de para meter op te geven -u
.If your user account has multi-factor authentication enabled, use the az login
command without providing the -u
parameter. Als u deze opdracht uitvoert, hebt u een URL en een code die u moet gebruiken om te verifiëren.Running this command gives you a URL and a code that you must use to authenticate.
Aanmelden als service- Principal:Sign in as a service principal:
Bereid het. pem-bestand voor op gebruik voor Service-Principal-aanmelding.Prepare the .pem file to be used for service principal login.
Op de client computer waarop de principal is gemaakt, exporteert u het certificaat van de Service-Principal als pfx met de persoonlijke sleutel die zich bevindt in cert:\CurrentUser\My
.On the client machine where the principal was created, export the service principal certificate as a pfx with the private key located at cert:\CurrentUser\My
. De certificaat naam heeft dezelfde naam als de principal.The cert name has the same name as the principal.
Converteer de PFX naar pem (gebruik het OpenSSL-hulp programma).Convert the pfx to pem (use the OpenSSL utility).
Meld u aan bij de CLI:Sign in to the CLI:
az login --service-principal \
-u <Client ID from the Service Principal details> \
-p <Certificate's fully qualified name, such as, C:\certs\spn.pem>
--tenant <Tenant ID> \
--debug
De connectiviteit testenTest the connectivity
Als alles is ingesteld, gebruikt u CLI om resources te maken in Azure Stack hub.With everything set up, use CLI to create resources within Azure Stack Hub. U kunt bijvoorbeeld een resource groep voor een app maken en een virtuele machine toevoegen.For example, you can create a resource group for an app and add a VM. Gebruik de volgende opdracht om een resource groep te maken met de naam ' MyResourceGroup ':Use the following command to create a resource group named "MyResourceGroup":
az group create -n MyResourceGroup -l local
Als de resource groep is gemaakt, voert de vorige opdracht de volgende eigenschappen van de zojuist gemaakte resource uit:If the resource group is created successfully, the previous command outputs the following properties of the newly created resource:

In deze sectie vindt u instructies voor het instellen van CLI als u gebruikmaakt van Azure AD als uw identiteits beheer service en gebruikmaakt van CLI op een Linux-computer.This section walks you through setting up CLI if you're using Azure AD as your identity management service, and are using CLI on a Linux machine.
Verbinding maken met Azure Stack hubConnect to Azure Stack Hub
Gebruik de volgende stappen om verbinding te maken met Azure Stack hub:Use the following steps to connect to Azure Stack Hub:
Als u de ASDK gebruikt, vertrouwt u het CA-basis certificaat van de Azure Stack hub.If you are using the ASDK, trust the Azure Stack Hub CA root certificate. Zie het certificaat vertrouwenvoor instructies.For instruction, see Trust the certificate.
Registreer uw Azure Stack hub-omgeving door de opdracht uit te voeren az cloud register
.Register your Azure Stack Hub environment by running the az cloud register
command.
Registreer uw omgeving.Register your environment. Gebruik de volgende para meters bij het uitvoeren van az cloud register
:Use the following parameters when running az cloud register
:
WaardeValue |
VoorbeeldExample |
BeschrijvingDescription |
OmgevingsnaamEnvironment name |
AzureStackUserAzureStackUser |
Gebruiken AzureStackUser voor de gebruikers omgeving.Use AzureStackUser for the user environment. Als u operator bent, geeft u op AzureStackAdmin .If you're operator, specify AzureStackAdmin . |
Resource Manager-eindpuntResource Manager endpoint |
https://management.local.azurestack.external |
De ResourceManagerUrl in de ASDK is: https://management.local.azurestack.external/ de ResourceManagerUrl in geïntegreerde systemen is: https://management.<region>.<fqdn>/ Als u een vraag hebt over het geïntegreerde systeem eindpunt, neemt u contact op met uw Cloud operator.The ResourceManagerUrl in the ASDK is: https://management.local.azurestack.external/ The ResourceManagerUrl in integrated systems is: https://management.<region>.<fqdn>/ If you have a question about the integrated system endpoint, contact your cloud operator. |
OpslageindpuntStorage endpoint |
lokaal. azurestack. externallocal.azurestack.external |
local.azurestack.external is voor de ASDK.local.azurestack.external is for the ASDK. Gebruik voor een geïntegreerd systeem een eind punt voor uw systeem.For an integrated system, use an endpoint for your system. |
Achtervoegsel voor sleutel kluisKeyvault suffix |
. kluis. local. azurestack. external.vault.local.azurestack.external |
.vault.local.azurestack.external is voor de ASDK..vault.local.azurestack.external is for the ASDK. Gebruik voor een geïntegreerd systeem een eind punt voor uw systeem.For an integrated system, use an endpoint for your system. |
Document eind punt alias van VM-installatie kopie-VM image alias doc endpoint- |
https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json |
De URI van het document, dat VM-afbeeldings aliassen bevat.URI of the document, which contains VM image aliases. Zie het eind punt van de alias van de virtuele machine instellenvoor meer informatie.For more info, see Set up the virtual machine alias endpoint. |
az cloud register -n <environmentname> --endpoint-resource-manager "https://management.local.azurestack.external" --suffix-storage-endpoint "local.azurestack.external" --suffix-keyvault-dns ".vault.local.azurestack.external" --endpoint-vm-image-alias-doc <URI of the document which contains VM image aliases>
Stel de actieve omgeving in.Set the active environment.
az cloud set -n <environmentname>
Werk uw omgevings configuratie bij om het API-versie Profiel van de Azure Stack hub te gebruiken.Update your environment configuration to use the Azure Stack Hub specific API version profile. Voer de volgende opdracht uit om de configuratie bij te werken:To update the configuration, run the following command:
az cloud update --profile 2019-03-01-hybrid
Notitie
Als u een versie van Azure Stack hub hebt vóór de 1808-build, moet u het API-versie profiel 2017-03-09-profile gebruiken in plaats van het API -versie profiel 2019-03-01-Hybrid.If you're running a version of Azure Stack Hub before the 1808 build, you must use the API version profile 2017-03-09-profile rather than the API version profile 2019-03-01-hybrid. U moet ook een recente versie van de Azure CLI gebruiken.You also need to use a recent version of the Azure CLI.
Meld u aan bij uw Azure Stack hub-omgeving met behulp van de az login
opdracht.Sign in to your Azure Stack Hub environment by using the az login
command. U kunt zich aanmelden bij de Azure Stack hub-omgeving als gebruiker of als service- Principal.You can sign in to the Azure Stack Hub environment either as a user or as a service principal.
Meld u aan als een gebruiker:Sign in as a user:
U kunt de gebruikersnaam en het wachtwoord rechtstreeks opgeven met de opdracht az login
of verifiëren met behulp van een browser.You can either specify the username and password directly within the az login
command, or authenticate by using a browser. U moet dit doen als voor uw account multi-factor Authentication is ingeschakeld:You must do the latter if your account has multi-factor authentication enabled:
az login \
-u <Active directory global administrator or user account. For example: username@<aadtenant>.onmicrosoft.com> \
--tenant <Azure Active Directory Tenant name. For example: myazurestack.onmicrosoft.com>
Notitie
Als voor uw gebruikers account multi-factor Authentication is ingeschakeld, kunt u de az login
opdracht gebruiken zonder de -u
para meter op te geven.If your user account has multi-factor authentication enabled, you can use the az login
command without providing the -u
parameter. Als u deze opdracht uitvoert, hebt u een URL en een code die u moet gebruiken om te verifiëren.Running this command gives you a URL and a code that you must use to authenticate.
Aanmelden als service- PrincipalSign in as a service principal
Voordat u zich aanmeldt, maakt u een Service-Principal via de Azure Portal of CLI en wijst u deze toe aan een rol.Before you sign in, create a service principal through the Azure portal or CLI and assign it a role. Meld u nu aan met de volgende opdracht:Now, sign in by using the following command:
az login \
--tenant <Azure Active Directory Tenant name. For example: myazurestack.onmicrosoft.com> \
--service-principal \
-u <Application Id of the Service Principal> \
-p <Key generated for the Service Principal>
De connectiviteit testenTest the connectivity
Als alles is ingesteld, gebruikt u CLI om resources te maken in Azure Stack hub.With everything set up, use CLI to create resources within Azure Stack Hub. U kunt bijvoorbeeld een resource groep voor een app maken en een virtuele machine toevoegen.For example, you can create a resource group for an app and add a VM. Gebruik de volgende opdracht om een resource groep te maken met de naam ' MyResourceGroup ':Use the following command to create a resource group named "MyResourceGroup":
az group create -n MyResourceGroup -l local
Als de resource groep is gemaakt, voert de vorige opdracht de volgende eigenschappen van de zojuist gemaakte resource uit:If the resource group is created successfully, the previous command outputs the following properties of the newly created resource:

In deze sectie vindt u instructies voor het instellen van CLI als u Active Directory Federated Services (AD FS) gebruikt als uw beheer service en gebruikmaakt van CLI op een Linux-computer.This section walks you through setting up CLI if you're using Active Directory Federated Services (AD FS) as your management service, and are using CLI on a Linux machine.
Verbinding maken met Azure Stack hubConnect to Azure Stack Hub
Gebruik de volgende stappen om verbinding te maken met Azure Stack hub:Use the following steps to connect to Azure Stack Hub:
Als u de ASDK gebruikt, vertrouwt u het CA-basis certificaat van de Azure Stack hub.If you are using the ASDK, trust the Azure Stack Hub CA root certificate. Zie het certificaat vertrouwenvoor instructies.For instruction, see Trust the certificate.
Registreer uw Azure Stack hub-omgeving door de opdracht uit te voeren az cloud register
.Register your Azure Stack Hub environment by running the az cloud register
command.
Registreer uw omgeving.Register your environment. Gebruik de volgende para meters wanneer u uitvoert az cloud register
.Use the following parameters when running az cloud register
.
WaardeValue |
VoorbeeldExample |
BeschrijvingDescription |
OmgevingsnaamEnvironment name |
AzureStackUserAzureStackUser |
Gebruiken AzureStackUser voor de gebruikers omgeving.Use AzureStackUser for the user environment. Als u operator bent, geeft u op AzureStackAdmin .If you're operator, specify AzureStackAdmin . |
Resource Manager-eindpuntResource Manager endpoint |
https://management.local.azurestack.external |
De ResourceManagerUrl in de ASDK is: https://management.local.azurestack.external/ de ResourceManagerUrl in geïntegreerde systemen is: https://management.<region>.<fqdn>/ Als u een vraag hebt over het geïntegreerde systeem eindpunt, neemt u contact op met uw Cloud operator.The ResourceManagerUrl in the ASDK is: https://management.local.azurestack.external/ The ResourceManagerUrl in integrated systems is: https://management.<region>.<fqdn>/ If you have a question about the integrated system endpoint, contact your cloud operator. |
OpslageindpuntStorage endpoint |
lokaal. azurestack. externallocal.azurestack.external |
local.azurestack.external is voor de ASDK.local.azurestack.external is for the ASDK. Gebruik voor een geïntegreerd systeem een eind punt voor uw systeem.For an integrated system, use an endpoint for your system. |
Achtervoegsel voor sleutel kluisKeyvault suffix |
. kluis. local. azurestack. external.vault.local.azurestack.external |
.vault.local.azurestack.external is voor de ASDK..vault.local.azurestack.external is for the ASDK. Gebruik voor een geïntegreerd systeem een eind punt voor uw systeem.For an integrated system, use an endpoint for your system. |
Document eind punt alias van VM-installatie kopie-VM image alias doc endpoint- |
https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json |
De URI van het document, dat VM-afbeeldings aliassen bevat.URI of the document, which contains VM image aliases. Zie het eind punt van de alias van de virtuele machine instellenvoor meer informatie.For more info, see Set up the virtual machine alias endpoint. |
az cloud register -n <environmentname> --endpoint-resource-manager "https://management.local.azurestack.external" --suffix-storage-endpoint "local.azurestack.external" --suffix-keyvault-dns ".vault.local.azurestack.external" --endpoint-vm-image-alias-doc <URI of the document which contains VM image aliases>
Stel de actieve omgeving in.Set the active environment.
az cloud set -n <environmentname>
Werk uw omgevings configuratie bij om het API-versie Profiel van de Azure Stack hub te gebruiken.Update your environment configuration to use the Azure Stack Hub specific API version profile. Voer de volgende opdracht uit om de configuratie bij te werken:To update the configuration, run the following command:
az cloud update --profile 2019-03-01-hybrid
Notitie
Als u een versie van Azure Stack hub hebt vóór de 1808-build, moet u het API-versie profiel 2017-03-09-profile gebruiken in plaats van het API -versie profiel 2019-03-01-Hybrid.If you're running a version of Azure Stack Hub before the 1808 build, you must use the API version profile 2017-03-09-profile rather than the API version profile 2019-03-01-hybrid. U moet ook een recente versie van de Azure CLI gebruiken.You also need to use a recent version of the Azure CLI.
Meld u aan bij uw Azure Stack hub-omgeving met behulp van de az login
opdracht.Sign in to your Azure Stack Hub environment by using the az login
command. U kunt zich aanmelden bij de Azure Stack hub-omgeving als gebruiker of als service- Principal.You can sign in to the Azure Stack Hub environment either as a user or as a service principal.
Aanmelden:Sign in:
- Als een gebruiker die gebruikmaakt van een webbrowser met een apparaatcode:As a user using a web browser with a device code:
az login --use-device-code
Notitie
Als u de opdracht uitvoert, hebt u een URL en een code die u moet gebruiken om te verifiëren.Running the command gives you a URL and a code that you must use to authenticate.
Als Service-Principal:As a service principal:
Bereid het. pem-bestand voor op gebruik voor Service-Principal-aanmelding.Prepare the .pem file to be used for service principal login.
Op de client computer waarop de principal is gemaakt, exporteert u het certificaat van de Service-Principal als pfx met de persoonlijke sleutel die zich bevindt in cert:\CurrentUser\My
.On the client machine where the principal was created, export the service principal certificate as a pfx with the private key located at cert:\CurrentUser\My
. De certificaat naam heeft dezelfde naam als de principal.The cert name has the same name as the principal.
Converteer de PFX naar pem (gebruik het OpenSSL-hulp programma).Convert the pfx to pem (use the OpenSSL utility).
Meld u aan bij de CLI:Sign in to the CLI:
az login --service-principal \
-u <Client ID from the Service Principal details> \
-p <Certificate's fully qualified name, such as, C:\certs\spn.pem>
--tenant <Tenant ID> \
--debug
De connectiviteit testenTest the connectivity
Als alles is ingesteld, gebruikt u CLI om resources te maken in Azure Stack hub.With everything set up, use CLI to create resources within Azure Stack Hub. U kunt bijvoorbeeld een resource groep voor een app maken en een virtuele machine toevoegen.For example, you can create a resource group for an app and add a VM. Gebruik de volgende opdracht om een resource groep te maken met de naam ' MyResourceGroup ':Use the following command to create a resource group named "MyResourceGroup":
az group create -n MyResourceGroup -l local
Als de resource groep is gemaakt, voert de vorige opdracht de volgende eigenschappen van de zojuist gemaakte resource uit:If the resource group is created successfully, the previous command outputs the following properties of the newly created resource:

Bekende problemenKnown issues
Er zijn bekende problemen bij het gebruik van CLI in Azure Stack hub:There are known issues when using CLI in Azure Stack Hub:
- De CLI-interactieve modus.The CLI interactive mode. De opdracht wordt bijvoorbeeld
az interactive
nog niet ondersteund in azure stack hub.For example, the az interactive
command, isn't yet supported in Azure Stack Hub.
- Als u de lijst met VM-installatie kopieën die beschikbaar zijn in Azure Stack hub wilt ophalen, gebruikt u de
az vm image list --all
opdracht in plaats van de az vm image list
opdracht.To get the list of VM images available in Azure Stack Hub, use the az vm image list --all
command instead of the az vm image list
command. Als u de optie opgeeft, --all
zorgt u ervoor dat het antwoord alleen de installatie kopieën retourneert die beschikbaar zijn in uw Azure stack hub-omgeving.Specifying the --all
option ensures that the response returns only the images that are available in your Azure Stack Hub environment.
- VM-afbeeldings aliassen die beschikbaar zijn in azure, zijn mogelijk niet van toepassing op Azure Stack hub.VM image aliases that are available in Azure may not be applicable to Azure Stack Hub. Wanneer u VM-installatie kopieën gebruikt, moet u de volledige URN-para meter (canonieke: UbuntuServer: 14.04.3-LTS: 1.0.0) gebruiken in plaats van de afbeeldings alias.When using VM images, you must use the entire URN parameter (Canonical:UbuntuServer:14.04.3-LTS:1.0.0) instead of the image alias. Deze URN moet overeenkomen met de specificaties van de installatie kopie die is afgeleid van de
az vm images list
opdracht.This URN must match the image specifications as derived from the az vm images list
command.