Site feedback

tysonflint avatar image
0 Votes"
tysonflint Posted ·

Unable to register ASDK: InvalidRegistrationToken : The registration token is malformed.

I have deployed ASDK version 1.2008.0.59. The installation was successful. I am now trying to register the ASDK under one of my subscription's tenant.
The resource group "azurestack" is successfully created in 'westcentralus' by the registration script, as I can see it show up in the Azure portal.
I've been deleting this resource group each time I reattempt the ASDK registration command.

I'm performing an AzureCloud deployment (not ADFS). I'm running it under the context of the global admin account of the tenant.

I'm running PowerShell 5.1.

Here is what I'm using for the ASDK registration (with xxx in replacing sensitive info).

 Connect-AzAccount -EnvironmentName "AzureCloud"
 Register-AzResourceProvider -ProviderNamespace Microsoft.AzureStack
 Get-AzSubscription -SubscriptionID "xxxxxxxx-xxxx-xxxx-xxxe-xxxxxxxxxxxx" -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | Set-AzContext
 Register-AzResourceProvider -ProviderNamespace Microsoft.AzureStack
 Import-Module C:\AzureStack-Tools-az\Registration\RegisterWithAzure.psm1
 $CloudAdminCred = Get-Credential -UserName AZURESTACK\CloudAdmin -Message "Enter the credentials to access the privileged endpoint."
 $RegistrationName = "TysonAsdkRegistration"
 Set-AzsRegistration `
 -PrivilegedEndpointCredential $CloudAdminCred `
 -PrivilegedEndpoint AzS-ERCS01 `
 -BillingModel Development `
 -RegistrationName $RegistrationName `
 -UsageReportingEnabled:$true


I am getting following error right after the resource group is created:

2021-02-26.00-35-06: InvalidRegistrationToken : The registration token is malformed.
2021-02-26.00-35-07: at New-RegistrationResource, C:\AzureStack-Tools-az\Registration\RegisterWithAzure.psm1: line 1386
at Set-AzsRegistration, C:\AzureStack-Tools-az\Registration\RegisterWithAzure.psm1: line 427
at < ScriptBlock >, <No file>: line 1


Line 1386 of RegisterWithAzure.psm1
$registrationResource = New-AzResource @resourceCreationParams -Force
Fails with message:
InvalidRegistrationToken : The registration token is malformed.

It is called from:

Line 426 of RegisterWithAzure.psm1
New-RegistrationResource -ResourceGroupName $ResourceGroupName -ResourceGroupLocation $ResourceGroupLocation -RegistrationToken $RegistrationToken -RegistrationName $RegistrationName

The values of the variables in the above line look correct with the exception of the $RegistrationToken, which does not end in a double equal sign as I would expect.

I successfully registered my ASDK using this same tenant last year. I blew that ASDK install away to upgrade to 1.2008.0.59. I deleted the old resource group in Azure before attempting this registration.
The only thing that might be different this time is that I'm using the newer Az modules, rather than the older AzureRM modules.

Here is the LOG, with my sensitive info XXX'ed out.

Do you have any ideas to try troubleshooting the validity of the $RegistrationToken.
Should a valid token end in "==" ?

I see the following are null, is this OK?
"CurrentStorageAccountName": null
"CurrentStorageAccount": null


These are empty strings, is that OK?
"AgreementNumber": ""
"MsAssetTag": ""

Thank you in advance for your ideas in troubleshooting!


====================================================================================================


 2021-02-26.00-30-06: *********************** Begin log: Set-AzsRegistration ***********************
    
 2021-02-26.00-30-12: Gathering info from current Azure Powershell context...
 2021-02-26.00-30-12: Current Azure Context: 
  {
     "Account":  {
                     "Id":  "tysonflint@xxxxxxxxxx.com",
                     "Type":  "User",
                     "Tenants":  [
                                     "xxxxxxxx-xxx-xxxx-xxx-xxxxxxxxxxx"
                                 ],
                     "AccessToken":  null,
                     "Credential":  null,
                     "TenantMap":  {
    
                                   },
                     "CertificateThumbprint":  null,
                     "ExtendedProperties":  {
                                                "Subscriptions":  "xxxxxxxx-xxxxx-xxxx-xxx-xxxxxxxxxxxx,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                                                "Tenants":  "xxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxx"
                                            }
                 },
     "Tenant":  {
                    "Id":  "xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxx",
                    "TenantId":  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                    "ExtendedProperties":  {
    
                                           }
                },
     "Environment":  {
                         "Name":  "AzureCloud",
                         "EnableAdfsAuthentication":  false,
                         "OnPremise":  false,
                         "ActiveDirectoryServiceEndpointResourceId":  "https://management.core.windows.net/",
                         "AdTenant":  "Common",
                         "GalleryUrl":  "https://gallery.azure.com/",
                         "ManagementPortalUrl":  "https://go.microsoft.com/fwlink/?LinkId=254433",
                         "ServiceManagementUrl":  "https://management.core.windows.net/",
                         "PublishSettingsFileUrl":  "https://go.microsoft.com/fwlink/?LinkID=301775",
                         "ResourceManagerUrl":  "https://management.azure.com/",
                         "SqlDatabaseDnsSuffix":  ".database.windows.net",
                         "StorageEndpointSuffix":  "core.windows.net",
                         "ActiveDirectoryAuthority":  "https://login.microsoftonline.com/",
                         "GraphUrl":  "https://graph.windows.net/",
                         "GraphEndpointResourceId":  "https://graph.windows.net/",
                         "TrafficManagerDnsSuffix":  "trafficmanager.net",
                         "AzureKeyVaultDnsSuffix":  "vault.azure.net",
                         "DataLakeEndpointResourceId":  "https://datalake.azure.net/",
                         "AzureDataLakeStoreFileSystemEndpointSuffix":  "azuredatalakestore.net",
                         "AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix":  "azuredatalakeanalytics.net",
                         "AzureKeyVaultServiceEndpointResourceId":  "https://vault.azure.net",
                         "AzureOperationalInsightsEndpointResourceId":  "https://api.loganalytics.io",
                         "AzureOperationalInsightsEndpoint":  "https://api.loganalytics.io/v1",
                         "AzureAnalysisServicesEndpointSuffix":  "asazure.windows.net",
                         "AnalysisServicesEndpointResourceId":  "https://region.asazure.windows.net",
                         "AzureAttestationServiceEndpointSuffix":  "attest.azure.net",
                         "AzureAttestationServiceEndpointResourceId":  "https://attest.azure.net",
                         "VersionProfiles":  [
    
                                             ],
                         "ExtendedProperties":  {
                                                    "OperationalInsightsEndpoint":  "https://api.loganalytics.io/v1",
                                                    "OperationalInsightsEndpointResourceId":  "https://api.loganalytics.io",
                                                    "AzureAnalysisServicesEndpointSuffix":  "asazure.windows.net",
                                                    "AnalysisServicesEndpointResourceId":  "https://region.asazure.windows.net",
                                                    "AzureAttestationServiceEndpointSuffix":  "attest.azure.net",
                                                    "AzureAttestationServiceEndpointResourceId":  "https://attest.azure.net"
                                                },
                         "BatchEndpointResourceId":  "https://batch.core.windows.net/"
                     },
     "Subscription":  {
                          "Id":  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                          "Name":  "Pay-As-You-Go",
                          "State":  "Enabled",
                          "SubscriptionId":  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                          "TenantId":  "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                          "CurrentStorageAccountName":  null,
                          "ExtendedProperties":  {
                                                     "Account":  "tysonflint@xxxxxxxxxxxxxx.com",
                                                     "Tenants":  "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx",
                                                     "Environment":  "AzureCloud"
                                                 },
                          "CurrentStorageAccount":  null
                      }
 }
 2021-02-26.00-30-12: Initializing session with privileged endpoint: AzS-ERCS01. Attempt 0 of 3
 2021-02-26.00-30-35: Connection to AzS-ERCS01 successful
 2021-02-26.00-30-35: Verifying stamp version.
 2021-02-26.00-30-45: Running registration actions on build 1.2008.0.59. Cloud Id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, Deployment Id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
 2021-02-26.00-30-46: Creating Azure Active Directory service principal in tenant 'xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxx' Attempt 0 of 3
 2021-02-26.00-33-58: Service principal created and Azure bridge configured. ObjectId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
 2021-02-26.00-33-58: Get-RegistrationToken parameters: {
     "AgreementNumber":  "",
     "MarketplaceSyndicationEnabled":  {
                                           "IsPresent":  true
                                       },
     "MsAssetTag":  "",
     "TokenVersion":  "4.0",
     "UsageReportingEnabled":  {
                                   "IsPresent":  true
                               },
     "BillingModel":  "Development"
 }
 2021-02-26.00-33-58: Creating registration token. Attempt 0 of 3
 2021-02-26.00-34-28: Registration token created.
 2021-02-26.00-34-28: Creating registration resource at ResourceGroupLocation: westcentralus
 2021-02-26.00-34-28: Registering Azure Stack resource provider.
 2021-02-26.00-34-30: Resource provider registered.
 2021-02-26.00-34-30: Resource creation params: {
     "ResourceType":  "Microsoft.AzureStack/registrations",
     "ResourceName":  "TysonAsdkRegistration",
     "Properties":  {
                        "registrationToken":  "eyJBZ3Jxxxx <There are 4096 bytes in this string, the ending does not end in a double equals sign like it has in the past.> xxxXX0="
                    },
     "ResourceGroupName":  "azurestack",
     "ApiVersion":  "2017-06-01",
     "Location":  "Global"
 }
 2021-02-26.00-34-31: Creating resource group 'azurestack' in location westcentralus.
 2021-02-26.00-34-32: Creating registration resource...
 2021-02-26.00-34-33: *** WARNING ***
 2021-02-26.00-34-33: Creation of Azure resource failed:
 InvalidRegistrationToken : The registration token is malformed.
 2021-02-26.00-34-33: *** End WARNING ***
 2021-02-26.00-34-33: Waiting 10 seconds and trying again...
 2021-02-26.00-34-43: Creating registration resource...
 2021-02-26.00-34-45: *** WARNING ***
 2021-02-26.00-34-45: Creation of Azure resource failed:
 InvalidRegistrationToken : The registration token is malformed.
 2021-02-26.00-34-45: *** End WARNING ***
 2021-02-26.00-34-45: Waiting 10 seconds and trying again...
 2021-02-26.00-34-55: Creating registration resource...
 2021-02-26.00-34-56: *** WARNING ***
 2021-02-26.00-34-56: Creation of Azure resource failed:
 InvalidRegistrationToken : The registration token is malformed.
 2021-02-26.00-34-56: *** End WARNING ***
 2021-02-26.00-34-56: Waiting 10 seconds and trying again...
 2021-02-26.00-35-06: ************************ Error ************************
 2021-02-26.00-35-06: InvalidRegistrationToken : The registration token is malformed.
 2021-02-26.00-35-07: at New-RegistrationResource, C:\AzureStack-Tools-az\Registration\RegisterWithAzure.psm1: line 1386
 at Set-AzsRegistration, C:\AzureStack-Tools-az\Registration\RegisterWithAzure.psm1: line 427
 at <ScriptBlock>, <No file>: line 1
 2021-02-26.00-35-07: *********************** Ending registration action during New-RegistrationResource ***********************
    
 2021-02-26.00-35-07: Logs can be found at: C:\MASLogs\Registration\AzureStack.Activation.Set-AzsRegistration-2021-02-26.log  and  \\AzS-ERCS01\c$\maslogs 
    
 2021-02-26.00-35-07: Removing any existing PSSession...


azure-stack-hub
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@tysonflint , thank you for the feedback. This area is for feedback on Microsoft Q&A feedback only. So we are closing this item.

0 Votes 0 ·

No Solutions

Your Opinion Counts

Share your feedback, or help out by voting for other people's feedback.