Ta sekcja przeprowadzi Cię przez proces konfigurowania interfejsu wiersza polecenia, jeśli korzystasz z usług Azure AD jako usługi zarządzania tożsamościami i korzystasz z interfejsu wiersza polecenia na komputerze z systemem Windows.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.
Nawiązywanie połączenia z centrum Azure StackConnect to Azure Stack Hub
Jeśli używasz ASDK, zaufaj certyfikatowi głównemu urzędu certyfikacji centrum Azure Stack.If you are using the ASDK, trust the Azure Stack Hub CA root certificate. Aby uzyskać instrukcje, zobacz temat ufanie certyfikatowi.For instruction, see Trust the certificate.
Zarejestruj środowisko centrum Azure Stack, uruchamiając az cloud register
polecenie.Register your Azure Stack Hub environment by running the az cloud register
command.
Zarejestruj swoje środowisko.Register your environment. Użyj następujących parametrów podczas uruchamiania az cloud register
:Use the following parameters when running az cloud register
:
WartośćValue |
PrzykładExample |
OpisDescription |
Nazwa środowiskaEnvironment name |
AzureStackUserAzureStackUser |
Używany AzureStackUser dla środowiska użytkownika.Use AzureStackUser for the user environment. Jeśli jesteś operatorem, określ AzureStackAdmin .If you're operator, specify AzureStackAdmin . |
Menedżer zasobów punkt końcowyResource Manager endpoint |
https://management.contoso.onmicrosoft.com |
ResourceManagerUrl w ASDK to: https://management.contoso.onmicrosoft.com/ ResourceManagerUrl w systemach zintegrowanych to: https://management.<region>.<fqdn>/ Jeśli masz pytanie dotyczące zintegrowanego punktu końcowego systemu, skontaktuj się z operatorem chmury.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. |
Punkt końcowy magazynuStorage endpoint |
local.contoso.onmicrosoft.comlocal.contoso.onmicrosoft.com |
local.azurestack.external jest dla ASDK.local.azurestack.external is for the ASDK. W przypadku systemu zintegrowanego Użyj punktu końcowego dla systemu.For an integrated system, use an endpoint for your system. |
Sufiks magazynu kluczyKeyvault suffix |
. vault.contoso.onmicrosoft.com.vault.contoso.onmicrosoft.com |
.vault.local.azurestack.external jest dla ASDK..vault.local.azurestack.external is for the ASDK. W przypadku systemu zintegrowanego Użyj punktu końcowego dla systemu.For an integrated system, use an endpoint for your system. |
Identyfikator zasobu programu Graph w usłudze Active Directory punktu końcowegoEndpoint active directory graph resource ID |
https://graph.windows.net/ |
Identyfikator zasobu usługi 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/"
Odwołanie do polecenia Register można znaleźć w dokumentacji dotyczącej interfejsu wiersza poleceń platformy Azure.You can find a reference for the register command in the Azure CLI reference documentation.
Ustaw aktywne środowisko przy użyciu następujących poleceń.Set the active environment by using the following commands.
az cloud set -n <environmentname>
Zaktualizuj konfigurację środowiska, aby użyć profilu wersji interfejsu API określonego przez centrum Azure Stack.Update your environment configuration to use the Azure Stack Hub specific API version profile. Aby zaktualizować konfigurację, uruchom następujące polecenie:To update the configuration, run the following command:
az cloud update --profile 2019-03-01-hybrid
Zaloguj się do środowiska Azure Stack Hub przy użyciu az login
polecenia.Sign in to your Azure Stack Hub environment by using the az login
command.
Możesz zalogować się do środowiska centrum Azure Stack przy użyciu poświadczeń użytkownika lub nazwy głównej usługi (SPN) udostępnionej przez operatora chmury.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.
Zaloguj się jako użytkownik:Sign in as a user:
Możesz określić nazwę użytkownika i hasło bezpośrednio w az login
poleceniu lub uwierzytelnić się za pomocą przeglądarki.You can either specify the username and password directly within the az login
command, or authenticate by using a browser. Należy wykonać te czynności, jeśli konto ma włączone uwierzytelnianie wieloskładnikowe: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
Uwaga
Jeśli konto użytkownika ma włączone uwierzytelnianie wieloskładnikowe, użyj az login
polecenia bez podawania -u
parametru.If your user account has multi-factor authentication enabled, use the az login
command without providing the -u
parameter. Uruchomienie tego polecenia daje adres URL i kod, którego należy użyć do uwierzytelnienia.Running this command gives you a URL and a code that you must use to authenticate.
Zaloguj się jako nazwa główna usługi:Sign in as a service principal:
Przed zalogowaniem się Utwórz jednostkę usługi za pomocą Azure Portal lub interfejsu wiersza polecenia i przypisz ją do roli.Before you sign in, create a service principal through the Azure portal or CLI and assign it a role. Teraz Zaloguj się przy użyciu następującego polecenia: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>
Sprawdź, czy środowisko jest prawidłowo ustawione i czy środowisko jest chmurą aktywną.Verify that your environment is set correctly and that your environment is the active cloud.
az cloud list --output table
Powinieneś zobaczyć, że Twoje środowisko jest wymienione i IsActive działa true
.You should see that your environment is listed and IsActive is true
. Na przykład: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
Testowanie połączeniaTest the connectivity
Ze wszystkimi konfiguracjami Użyj interfejsu wiersza polecenia do tworzenia zasobów w ramach Centrum Azure Stack.With everything set up, use CLI to create resources within Azure Stack Hub. Można na przykład utworzyć grupę zasobów dla aplikacji i dodać maszynę wirtualną.For example, you can create a resource group for an app and add a VM. Użyj następującego polecenia, aby utworzyć grupę zasobów o nazwie "Grupa zasobów":Use the following command to create a resource group named "MyResourceGroup":
az group create -n MyResourceGroup -l local
Jeśli grupa zasobów została utworzona pomyślnie, poprzednie polecenie wyświetla następujące właściwości nowo utworzonego zasobu:If the resource group is created successfully, the previous command outputs the following properties of the newly created resource:

W tej sekcji omówiono konfigurowanie interfejsu wiersza polecenia, jeśli używasz usług federacyjnych Active Directory (AD FS) jako usługi zarządzania tożsamościami i korzystasz z interfejsu wiersza polecenia na komputerze z systemem Windows.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.
Nawiązywanie połączenia z centrum Azure StackConnect to Azure Stack Hub
Jeśli używasz ASDK, zaufaj certyfikatowi głównemu urzędu certyfikacji centrum Azure Stack.If you are using the ASDK, trust the Azure Stack Hub CA root certificate. Aby uzyskać instrukcje, zobacz temat ufanie certyfikatowi.For instruction, see Trust the certificate.
Zarejestruj środowisko centrum Azure Stack, uruchamiając az cloud register
polecenie.Register your Azure Stack Hub environment by running the az cloud register
command.
Zarejestruj swoje środowisko.Register your environment. Użyj następujących parametrów podczas uruchamiania az cloud register
:Use the following parameters when running az cloud register
:
WartośćValue |
PrzykładExample |
OpisDescription |
Nazwa środowiskaEnvironment name |
AzureStackUserAzureStackUser |
Używany AzureStackUser dla środowiska użytkownika.Use AzureStackUser for the user environment. Jeśli jesteś operatorem, określ AzureStackAdmin .If you're operator, specify AzureStackAdmin . |
Menedżer zasobów punkt końcowyResource Manager endpoint |
https://management.local.azurestack.external |
ResourceManagerUrl w ASDK to: https://management.local.azurestack.external/ ResourceManagerUrl w systemach zintegrowanych to: https://management.<region>.<fqdn>/ Jeśli masz pytanie dotyczące zintegrowanego punktu końcowego systemu, skontaktuj się z operatorem chmury.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. |
Punkt końcowy magazynuStorage endpoint |
Local. azurestack. externallocal.azurestack.external |
local.azurestack.external jest dla ASDK.local.azurestack.external is for the ASDK. W przypadku systemu zintegrowanego Użyj punktu końcowego dla systemu.For an integrated system, use an endpoint for your system. |
Sufiks magazynu kluczyKeyvault suffix |
. magazyn. local. azurestack. external.vault.local.azurestack.external |
.vault.local.azurestack.external jest dla ASDK..vault.local.azurestack.external is for the ASDK. W przypadku systemu zintegrowanego Użyj punktu końcowego dla systemu.For an integrated system, use an endpoint for your system. |
Punkt końcowy dokumentu aliasu obrazu maszyny wirtualnej —VM image alias doc endpoint- |
https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json |
Identyfikator URI dokumentu, który zawiera aliasy obrazów maszyn wirtualnych.URI of the document, which contains VM image aliases. Aby uzyskać więcej informacji, zobacz konfigurowanie punktu końcowego aliasu maszyny wirtualnej.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>
Ustaw aktywne środowisko przy użyciu następujących poleceń.Set the active environment by using the following commands.
az cloud set -n <environmentname>
Zaktualizuj konfigurację środowiska, aby użyć profilu wersji interfejsu API określonego przez centrum Azure Stack.Update your environment configuration to use the Azure Stack Hub specific API version profile. Aby zaktualizować konfigurację, uruchom następujące polecenie:To update the configuration, run the following command:
az cloud update --profile 2019-03-01-hybrid
Uwaga
Jeśli używasz wersji Azure Stack Hub przed kompilacją 1808, musisz użyć profilu wersji interfejsu API 2017-03-09-profile zamiast profilu wersji interfejsu API 2019-03-01-hybrydowego.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. Należy również użyć najnowszej wersji interfejsu wiersza polecenia platformy Azure.You also need to use a recent version of the Azure CLI.
Zaloguj się do środowiska Azure Stack Hub przy użyciu az login
polecenia.Sign in to your Azure Stack Hub environment by using the az login
command. Możesz zalogować się do środowiska centrum Azure Stack jako użytkownik lub jako nazwa główna usługi.You can sign in to the Azure Stack Hub environment either as a user or as a service principal.
Zaloguj się jako użytkownik:Sign in as a user:
Możesz określić nazwę użytkownika i hasło bezpośrednio w az login
poleceniu lub uwierzytelnić się za pomocą przeglądarki.You can either specify the username and password directly within the az login
command, or authenticate by using a browser. Należy wykonać te czynności, jeśli konto ma włączone uwierzytelnianie wieloskładnikowe: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"
Uwaga
Jeśli konto użytkownika ma włączone uwierzytelnianie wieloskładnikowe, użyj az login
polecenia bez podawania -u
parametru.If your user account has multi-factor authentication enabled, use the az login
command without providing the -u
parameter. Uruchomienie tego polecenia daje adres URL i kod, którego należy użyć do uwierzytelnienia.Running this command gives you a URL and a code that you must use to authenticate.
Zaloguj się jako nazwa główna usługi:Sign in as a service principal:
Przygotuj plik PEM, który ma być używany na potrzeby logowania do nazwy głównej usługi.Prepare the .pem file to be used for service principal login.
Na komputerze klienckim, na którym utworzono podmiot zabezpieczeń, wyeksportuj certyfikat głównej usługi jako plik PFX z kluczem prywatnym znajdującym się w lokalizacji 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
. Nazwa certyfikatu ma taką samą nazwę jak nazwa podmiotu zabezpieczeń.The cert name has the same name as the principal.
Przekonwertuj plik pfx na PEM (Użyj narzędzia OpenSSL).Convert the pfx to pem (use the OpenSSL utility).
Zaloguj się do interfejsu wiersza polecenia: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
Testowanie połączeniaTest the connectivity
Ze wszystkimi konfiguracjami Użyj interfejsu wiersza polecenia do tworzenia zasobów w ramach Centrum Azure Stack.With everything set up, use CLI to create resources within Azure Stack Hub. Można na przykład utworzyć grupę zasobów dla aplikacji i dodać maszynę wirtualną.For example, you can create a resource group for an app and add a VM. Użyj następującego polecenia, aby utworzyć grupę zasobów o nazwie "Grupa zasobów":Use the following command to create a resource group named "MyResourceGroup":
az group create -n MyResourceGroup -l local
Jeśli grupa zasobów została utworzona pomyślnie, poprzednie polecenie wyświetla następujące właściwości nowo utworzonego zasobu:If the resource group is created successfully, the previous command outputs the following properties of the newly created resource:

Ta sekcja przeprowadzi Cię przez proces konfigurowania interfejsu wiersza polecenia, jeśli korzystasz z usług Azure AD jako usługi zarządzania tożsamościami i korzystasz z interfejsu wiersza polecenia na komputerze z systemem Linux.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.
Nawiązywanie połączenia z centrum Azure StackConnect to Azure Stack Hub
Aby nawiązać połączenie z centrum Azure Stack, wykonaj następujące kroki:Use the following steps to connect to Azure Stack Hub:
Jeśli używasz ASDK, zaufaj certyfikatowi głównemu urzędu certyfikacji centrum Azure Stack.If you are using the ASDK, trust the Azure Stack Hub CA root certificate. Aby uzyskać instrukcje, zobacz temat ufanie certyfikatowi.For instruction, see Trust the certificate.
Zarejestruj środowisko centrum Azure Stack, uruchamiając az cloud register
polecenie.Register your Azure Stack Hub environment by running the az cloud register
command.
Zarejestruj swoje środowisko.Register your environment. Użyj następujących parametrów podczas uruchamiania az cloud register
:Use the following parameters when running az cloud register
:
WartośćValue |
PrzykładExample |
OpisDescription |
Nazwa środowiskaEnvironment name |
AzureStackUserAzureStackUser |
Używany AzureStackUser dla środowiska użytkownika.Use AzureStackUser for the user environment. Jeśli jesteś operatorem, określ AzureStackAdmin .If you're operator, specify AzureStackAdmin . |
Menedżer zasobów punkt końcowyResource Manager endpoint |
https://management.local.azurestack.external |
ResourceManagerUrl w ASDK to: https://management.local.azurestack.external/ ResourceManagerUrl w systemach zintegrowanych to: https://management.<region>.<fqdn>/ Jeśli masz pytanie dotyczące zintegrowanego punktu końcowego systemu, skontaktuj się z operatorem chmury.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. |
Punkt końcowy magazynuStorage endpoint |
Local. azurestack. externallocal.azurestack.external |
local.azurestack.external jest dla ASDK.local.azurestack.external is for the ASDK. W przypadku systemu zintegrowanego Użyj punktu końcowego dla systemu.For an integrated system, use an endpoint for your system. |
Sufiks magazynu kluczyKeyvault suffix |
. magazyn. local. azurestack. external.vault.local.azurestack.external |
.vault.local.azurestack.external jest dla ASDK..vault.local.azurestack.external is for the ASDK. W przypadku systemu zintegrowanego Użyj punktu końcowego dla systemu.For an integrated system, use an endpoint for your system. |
Punkt końcowy dokumentu aliasu obrazu maszyny wirtualnej —VM image alias doc endpoint- |
https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json |
Identyfikator URI dokumentu, który zawiera aliasy obrazów maszyn wirtualnych.URI of the document, which contains VM image aliases. Aby uzyskać więcej informacji, zobacz konfigurowanie punktu końcowego aliasu maszyny wirtualnej.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>
Ustawianie aktywnego środowiska.Set the active environment.
az cloud set -n <environmentname>
Zaktualizuj konfigurację środowiska, aby użyć profilu wersji interfejsu API określonego przez centrum Azure Stack.Update your environment configuration to use the Azure Stack Hub specific API version profile. Aby zaktualizować konfigurację, uruchom następujące polecenie:To update the configuration, run the following command:
az cloud update --profile 2019-03-01-hybrid
Uwaga
Jeśli używasz wersji Azure Stack Hub przed kompilacją 1808, musisz użyć profilu wersji interfejsu API 2017-03-09-profile zamiast profilu wersji interfejsu API 2019-03-01-hybrydowego.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. Należy również użyć najnowszej wersji interfejsu wiersza polecenia platformy Azure.You also need to use a recent version of the Azure CLI.
Zaloguj się do środowiska Azure Stack Hub przy użyciu az login
polecenia.Sign in to your Azure Stack Hub environment by using the az login
command. Możesz zalogować się do środowiska centrum Azure Stack jako użytkownik lub jako nazwa główna usługi.You can sign in to the Azure Stack Hub environment either as a user or as a service principal.
Zaloguj się jako użytkownik:Sign in as a user:
Możesz określić nazwę użytkownika i hasło bezpośrednio w az login
poleceniu lub uwierzytelnić się za pomocą przeglądarki.You can either specify the username and password directly within the az login
command, or authenticate by using a browser. Należy wykonać te czynności, jeśli konto ma włączone uwierzytelnianie wieloskładnikowe: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>
Uwaga
Jeśli konto użytkownika ma włączone uwierzytelnianie wieloskładnikowe, można użyć az login
polecenia bez podawania -u
parametru.If your user account has multi-factor authentication enabled, you can use the az login
command without providing the -u
parameter. Uruchomienie tego polecenia daje adres URL i kod, którego należy użyć do uwierzytelnienia.Running this command gives you a URL and a code that you must use to authenticate.
Zaloguj się jako nazwa główna usługiSign in as a service principal
Przed zalogowaniem się Utwórz jednostkę usługi za pomocą Azure Portal lub interfejsu wiersza polecenia i przypisz ją do roli.Before you sign in, create a service principal through the Azure portal or CLI and assign it a role. Teraz Zaloguj się przy użyciu następującego polecenia: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>
Testowanie połączeniaTest the connectivity
Ze wszystkimi konfiguracjami Użyj interfejsu wiersza polecenia do tworzenia zasobów w ramach Centrum Azure Stack.With everything set up, use CLI to create resources within Azure Stack Hub. Można na przykład utworzyć grupę zasobów dla aplikacji i dodać maszynę wirtualną.For example, you can create a resource group for an app and add a VM. Użyj następującego polecenia, aby utworzyć grupę zasobów o nazwie "Grupa zasobów":Use the following command to create a resource group named "MyResourceGroup":
az group create -n MyResourceGroup -l local
Jeśli grupa zasobów została utworzona pomyślnie, poprzednie polecenie wyświetla następujące właściwości nowo utworzonego zasobu:If the resource group is created successfully, the previous command outputs the following properties of the newly created resource:

Ta sekcja przeprowadzi Cię przez proces konfigurowania interfejsu wiersza polecenia, jeśli używasz usługi federacyjnej Active Directory (AD FS) jako usługi zarządzania i korzystasz z interfejsu wiersza polecenia na komputerze z systemem Linux.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.
Nawiązywanie połączenia z centrum Azure StackConnect to Azure Stack Hub
Aby nawiązać połączenie z centrum Azure Stack, wykonaj następujące kroki:Use the following steps to connect to Azure Stack Hub:
Jeśli używasz ASDK, zaufaj certyfikatowi głównemu urzędu certyfikacji centrum Azure Stack.If you are using the ASDK, trust the Azure Stack Hub CA root certificate. Aby uzyskać instrukcje, zobacz temat ufanie certyfikatowi.For instruction, see Trust the certificate.
Zarejestruj środowisko centrum Azure Stack, uruchamiając az cloud register
polecenie.Register your Azure Stack Hub environment by running the az cloud register
command.
Zarejestruj swoje środowisko.Register your environment. Użyj następujących parametrów podczas uruchamiania az cloud register
.Use the following parameters when running az cloud register
.
WartośćValue |
PrzykładExample |
OpisDescription |
Nazwa środowiskaEnvironment name |
AzureStackUserAzureStackUser |
Używany AzureStackUser dla środowiska użytkownika.Use AzureStackUser for the user environment. Jeśli jesteś operatorem, określ AzureStackAdmin .If you're operator, specify AzureStackAdmin . |
Menedżer zasobów punkt końcowyResource Manager endpoint |
https://management.local.azurestack.external |
ResourceManagerUrl w ASDK to: https://management.local.azurestack.external/ ResourceManagerUrl w systemach zintegrowanych to: https://management.<region>.<fqdn>/ Jeśli masz pytanie dotyczące zintegrowanego punktu końcowego systemu, skontaktuj się z operatorem chmury.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. |
Punkt końcowy magazynuStorage endpoint |
Local. azurestack. externallocal.azurestack.external |
local.azurestack.external jest dla ASDK.local.azurestack.external is for the ASDK. W przypadku systemu zintegrowanego Użyj punktu końcowego dla systemu.For an integrated system, use an endpoint for your system. |
Sufiks magazynu kluczyKeyvault suffix |
. magazyn. local. azurestack. external.vault.local.azurestack.external |
.vault.local.azurestack.external jest dla ASDK..vault.local.azurestack.external is for the ASDK. W przypadku systemu zintegrowanego Użyj punktu końcowego dla systemu.For an integrated system, use an endpoint for your system. |
Punkt końcowy dokumentu aliasu obrazu maszyny wirtualnej —VM image alias doc endpoint- |
https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json |
Identyfikator URI dokumentu, który zawiera aliasy obrazów maszyn wirtualnych.URI of the document, which contains VM image aliases. Aby uzyskać więcej informacji, zobacz konfigurowanie punktu końcowego aliasu maszyny wirtualnej.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>
Ustawianie aktywnego środowiska.Set the active environment.
az cloud set -n <environmentname>
Zaktualizuj konfigurację środowiska, aby użyć profilu wersji interfejsu API określonego przez centrum Azure Stack.Update your environment configuration to use the Azure Stack Hub specific API version profile. Aby zaktualizować konfigurację, uruchom następujące polecenie:To update the configuration, run the following command:
az cloud update --profile 2019-03-01-hybrid
Uwaga
Jeśli używasz wersji Azure Stack Hub przed kompilacją 1808, musisz użyć profilu wersji interfejsu API 2017-03-09-profile zamiast profilu wersji interfejsu API 2019-03-01-hybrydowego.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. Należy również użyć najnowszej wersji interfejsu wiersza polecenia platformy Azure.You also need to use a recent version of the Azure CLI.
Zaloguj się do środowiska Azure Stack Hub przy użyciu az login
polecenia.Sign in to your Azure Stack Hub environment by using the az login
command. Możesz zalogować się do środowiska centrum Azure Stack jako użytkownik lub jako nazwa główna usługi.You can sign in to the Azure Stack Hub environment either as a user or as a service principal.
Rejestrowanie:Sign in:
- Jako użytkownik korzystający z przeglądarki sieci Web przy użyciu kodu urządzenia:As a user using a web browser with a device code:
az login --use-device-code
Uwaga
Uruchomienie polecenia daje adres URL i kod, którego należy użyć do uwierzytelnienia.Running the command gives you a URL and a code that you must use to authenticate.
Jako nazwa główna usługi:As a service principal:
Przygotuj plik PEM, który ma być używany na potrzeby logowania do nazwy głównej usługi.Prepare the .pem file to be used for service principal login.
Na komputerze klienckim, na którym utworzono podmiot zabezpieczeń, wyeksportuj certyfikat głównej usługi jako plik PFX z kluczem prywatnym znajdującym się w lokalizacji 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
. Nazwa certyfikatu ma taką samą nazwę jak nazwa podmiotu zabezpieczeń.The cert name has the same name as the principal.
Przekonwertuj plik pfx na PEM (Użyj narzędzia OpenSSL).Convert the pfx to pem (use the OpenSSL utility).
Zaloguj się do interfejsu wiersza polecenia: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
Testowanie połączeniaTest the connectivity
Ze wszystkimi konfiguracjami Użyj interfejsu wiersza polecenia do tworzenia zasobów w ramach Centrum Azure Stack.With everything set up, use CLI to create resources within Azure Stack Hub. Można na przykład utworzyć grupę zasobów dla aplikacji i dodać maszynę wirtualną.For example, you can create a resource group for an app and add a VM. Użyj następującego polecenia, aby utworzyć grupę zasobów o nazwie "Grupa zasobów":Use the following command to create a resource group named "MyResourceGroup":
az group create -n MyResourceGroup -l local
Jeśli grupa zasobów została utworzona pomyślnie, poprzednie polecenie wyświetla następujące właściwości nowo utworzonego zasobu:If the resource group is created successfully, the previous command outputs the following properties of the newly created resource:

Znane problemyKnown issues
Istnieją znane problemy występujące podczas korzystania z interfejsu wiersza polecenia w centrum Azure Stack:There are known issues when using CLI in Azure Stack Hub:
- Tryb interaktywny interfejsu wiersza polecenia.The CLI interactive mode. Na przykład
az interactive
polecenie nie jest jeszcze obsługiwane w centrum Azure Stack.For example, the az interactive
command, isn't yet supported in Azure Stack Hub.
- Aby uzyskać listę obrazów maszyn wirtualnych dostępnych w centrum Azure Stack, użyj
az vm image list --all
polecenia zamiast az vm image list
polecenia.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. Określenie --all
opcji gwarantuje, że odpowiedź zwróci tylko obrazy, które są dostępne w środowisku centrum Azure Stack.Specifying the --all
option ensures that the response returns only the images that are available in your Azure Stack Hub environment.
- Aliasy obrazów maszyn wirtualnych, które są dostępne na platformie Azure, mogą nie mieć zastosowania do centrum Azure Stack.VM image aliases that are available in Azure may not be applicable to Azure Stack Hub. W przypadku używania obrazów maszyn wirtualnych należy użyć całego parametru URN (kanoniczny: UbuntuServer: 14.04.3-LTS: 1.0.0) zamiast aliasu obrazu.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. Ta nazwa URN musi być zgodna ze specyfikacją obrazu jako pochodną w
az vm images list
poleceniu.This URN must match the image specifications as derived from the az vm images list
command.