I am stuck with registering asdk

Darren 181 Reputation points
2020-06-27T10:42:27.557+00:00

Hello can anyone help with this failure log please

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> Add-AzureRmAccount -EnvironmentName Azurecloud

Account SubscriptionName TenantId Environment


d*********************** AzureCloud

PS C:\Windows\system32> Register-AzureRmResourceProvider -ProviderNamespace Microsoft.AzureStack
Register-AzureRmResourceProvider : 'this.Client.SubscriptionId' cannot be null.
At line:1 char:1

  • Register-AzureRmResourceProvider -ProviderNamespace 920c6041-ce2a-44b ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : CloseError: (:) [Register-AzureRmResourceProvider], ValidationException
  • FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.RegisterAzureProviderCmd
    let

PS C:\Windows\system32> Import-Module C:\AzureStack-Tools-master\Registration\RegisterWithAzure.psm1
PS C:\Windows\system32
PS C:\Windows\system32> $AzureContext = Get-AzureRmContext
PS C:\Windows\system32> $CloudAdminCred = Get-Credential -UserName AZURESTACK\CloudAdmin -Message "Enter the credentials to access the privileged endpoint."
PS C:\Windows\system32> $RegistrationName = baseodforstack
baseodforstack : The term 'baseodforstack' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:21

  • $RegistrationName = baseodforstack
  • ~~~~~~~~~~~~~~
  • CategoryInfo : ObjectNotFound: (baseodforstack:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException

PS C:\Windows\system32> Set-AzsRegistration >> -PrivilegedEndpointCredential $CloudAdminCred
>> -PrivilegedEndpoint AzS-ERCS01 >> -BillingModel Development
>> -RegistrationName $RegistrationName `
>> -UsageReportingEnabled:$true

Azure Stack Hub
Azure Stack Hub
An extension of Azure for running apps in an on-premises environment and delivering Azure services in a datacenter.
180 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. BhargaviAnnadevara-MSFT 5,461 Reputation points
    2020-07-19T08:52:20.307+00:00

    Hello @Darren ,

    It looks like you were able to add your Azure Account successfully using the Add-AzureRmAccount cmdlet.

    However, please run the following cmdlets to select your SubscriptionId before proceeding with registering the Azure Stack resource provider:

    PS C:\>Get-AzureRmSubscription -SubscriptionId "xxxx-xxxx-xxxx-xxxx" -TenantId "yyyy-yyyy-yyyy-yyyy" | Set-AzureRmContext

    This command gets the specified subscription, and then sets the current context to use it. All subsequent cmdlets in this session would then use this subscription by default.

    You can then proceed with the next steps for registering the ASDK as detailed here.

    0 comments No comments

  2. TravisCragg-MSFT 5,681 Reputation points Microsoft Employee
    2020-07-22T01:23:11.113+00:00

    Try to put the registration name in quotes, for example, "baseodforstack". There is no restrictions for what the name can be, and it looks like your PowerShell is trying to run it as a command name instead of a variable.

    You can also skip the variable and specify it straight in the registration command:

     Set-AzsRegistration  -PrivilegedEndpointCredential $CloudAdminCred -PrivilegedEndpoint AzS-ERCS01  -BillingModel Development -RegistrationName "baseodforstack" -UsageReportingEnabled:$true
    
    0 comments No comments