Delen via


Set-AksHciRegistration

Samenvatting

Registreert AKS hybride met Azure.

Syntaxis

Set-AksHciRegistration -subscriptionId<String>
                       -resourceGroupName <String>
                      [-tenantId <String>]
                      [-armAccessToken <String>]
                      [-graphAccessToken <String>]
                      [-accountId <String>]
                      [-environmentName <String>]
                      [-credential <PSCredential>]
                      [-region <String>]
                      [-useDeviceAuthentication]
                      [-skipLogin]

Beschrijving

Registreert AKS hybride met Azure.

Voorbeelden

AKS hybride registreren met behulp van een abonnements-id en resourcegroepnaam

Set-AksHciRegistration -subscriptionId aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e -resourceGroupName myresourcegroup

Registreren bij een apparaataanmelding of tijdens het uitvoeren in een headless shell

Set-AksHciRegistration -subscriptionId myazuresubscription -resourceGroupName myresourcegroup -UseDeviceAuthentication

AKS hybride registreren met behulp van een service-principal

Als u geen toegang hebt tot een abonnement waarvoor u eigenaar bent, kunt u uw AKS-host registreren bij Azure voor facturering met behulp van een service-principal.

Meld u aan bij Azure met behulp van de opdracht Connect-AzAccount PowerShell:

Connect-AzAccount

Stel het abonnement in dat u wilt gebruiken om uw AKS-host te registreren voor facturering als het standaardabonnement door de opdracht Set-AzContext uit te voeren.

Set-AzContext -Subscription myAzureSubscription

Controleer of uw aanmeldingscontext juist is door de opdracht Get-AzContext PowerShell uit te voeren. Controleer of het abonnement, de tenant en het account zijn wat u wilt gebruiken om uw AKS-host te registreren voor facturering.

Get-AzContext
Name                                     Account                      SubscriptionName             Environment                  TenantId
----                                     -------                      ----------------             -----------                  --------
myAzureSubscription (92391anf-...        user@contoso.com             myAzureSubscription          AzureCloud                   xxxxxx-xxxx-xxxx-xxxxxx

Uw tenant-id opnieuw instellen.

$tenant = (Get-AzContext).Tenant.Id

Maak een service-principal door de opdracht New-AzADServicePrincipal PowerShell uit te voeren. Met deze opdracht maakt u een service-principal met de rol Inzender en stelt u het bereik in op abonnementsniveau. Ga naar een Azure-service-principal maken met Azure PowerShellvoor meer informatie over het maken van service-principals.

$sp = New-AzADServicePrincipal -Role "Contributor" -Scope "/subscriptions/myazuresubscription"

Haal het wachtwoord voor de service-principal op door de volgende opdracht uit te voeren:

$secret = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($sp.Secret))
Write-Host "Application ID: $($sp.ApplicationId)"
Write-Host "App Secret: $secret"

In de bovenstaande uitvoer hebt u nu de toepassings-id en het geheim beschikbaar bij het implementeren van hybride AKS. Noteer deze items en sla ze veilig op. Nu u de toepassings-id en het geheim beschikbaar hebt, ziet u in de Azure Portalonder Abonnementen, toegangsbeheeren vervolgens roltoewijzingende nieuwe service-principal.

Sla uw service-principalreferenties (de toepassings-id en het geheim) op met Get-Credentialen stel vervolgens de registratie in.

$credential = Get-Credential
Set-AksHciRegistration -SubscriptionId myazuresubscription -ResourceGroupName myresourcegroup -TenantId $tenant -Credential $credential

Parameters

-subscriptionId

De id van het Azure-abonnement dat moet worden gebruikt.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-resourceGroupName

Naam van de resourcegroep om Arc-resources te plaatsen.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-tenantId

De tenant-id van uw Azure-service-principal.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-armAccessToken

Het token voor toegang tot Azure Resource Manager.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-graphAccessToken

Het token voor toegang tot de grafiek.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-accountId

Id van het Azure-account.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 1
Accept pipeline input: False
Accept wildcard characters: False

-environmentName

De naam van de beoogde openbare cloud.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-geloofsbrief

Een PSCredential die de service-principal van de gebruiker bevat.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-regio

De Azure-locatie.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-useDeviceAuthentication

Hiermee wordt een code uitgevoerd die in de browser moet worden gebruikt.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-skipLogin

Slaat de Connect-AzAccount-oproep over. Deze vlag is handig bij automatisering of wanneer deze wordt uitgevoerd vanuit een verbonden shell.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Volgende stappen

AksHci PowerShell-referentie