none
Azure Stack SQL RP installation script failed

    Question

  • Hi,

    I tried to install Azure Stack SQL RP with two different scripts and for both installation failed with different error as follows:

    First Script:

    # Variables

    $defaultLocalPath = "C:\AzureStackOnAzureVM" 

    $domain = "AzureStack"

    $prefix = "AzS"

    $privilegedEndpoint = "$prefix-ERCS01" 

    $aadAdmin = "Admin@Magakhnoukoutlook.onmicrosoft.com"

    $cloudAdmin = "AZURESTACK\CloudAdmin"

    $vmLocalAdmin = "sqlrpadmin" 

    $AadTenant = "Magakhnoukoutlook.onmicrosoft.com"

    # Pointer to the directory where the RP installation files will be extracted

    $tempDir = "$defaultLocalPath\SQLRP"

    # Find latest SQL RP bits' url

    $url = "https://aka.ms/azurestacksqlrp"  

    $WebClientObject = New-Object System.Net.WebClient

    $WebRequest = [System.Net.WebRequest]::create($URL)

    $WebResponse = $WebRequest.GetResponse()

    $ActualDownloadURL = $WebResponse.ResponseUri.AbsoluteUri

    $WebResponse.Close()

    # Download and extract latest SQL RP bits

    New-Item `

        -Path $tempDir `

        -ItemType Directory -Force

    cd $tempDir

    Start-BitsTransfer `

        -Source $ActualDownloadURL `

        -Destination $defaultLocalPath\sqlrp.zip

    Unblock-File `

        $defaultLocalPath\sqlrp.zip

    Expand-Archive `

        -Path  $defaultLocalPath\sqlrp.zip `

        -DestinationPath $tempDir -Force

    # Create credential object for service admin account

    $aadAdminPass = ConvertTo-SecureString "MAGnfjcg@" -AsPlainText -Force

    $aadAdminCred = New-Object System.Management.Automation.PSCredential ("$aadAdmin", $aadAdminPass)  

    #and the cloudadmin credential required for Privileged Endpoint access

    $cloudAdminPass = ConvertTo-SecureString "MAGnfjcg!@#$" -AsPlainText -Force

    $cloudAdminCred = New-Object System.Management.Automation.PSCredential ($cloudAdmin, $cloudAdminPass) 

    # Set credentials for the new Resource Provider VM

    $vmLocalAdminPass = ConvertTo-SecureString "MAGnfjcg!@#$" -AsPlainText -Force

    $vmLocalAdminCred = New-Object System.Management.Automation.PSCredential ($vmLocalAdmin, $vmLocalAdminPass) 

    # change the following as appropriate

    $PfxPass = ConvertTo-SecureString "MAGnfjcg!@#$" -AsPlainText -Force

    # For Azure Stack development kit, this value is set to https://adminmanagement.local.azurestack.external.

    $ArmEndpoint =  "https://adminmanagement.local.azurestack.external"

    # Register an AzureRM environment that targets your Azure Stack instance

    Add-AzureRMEnvironment `

      -Name "AzureStackAdmin" `

      -ArmEndpoint $ArmEndpoint

    # Get the Active Directory tenantId

    $AuthEndpoint = (Get-AzureRmEnvironment -Name "AzureStackAdmin").ActiveDirectoryAuthority.TrimEnd('/')

    $TenantId = (invoke-restmethod "$($AuthEndpoint)/$($AADTenant)/.well-known/openid-configuration").issuer.TrimEnd('/').Split('/')[-1]

    # Sign in to your environment

    Login-AzureRmAccount `

      -EnvironmentName "AzureStackAdmin" `

      -TenantId $TenantID `

      -Credential $AadAdminCred

    # Change directory to the folder where you extracted the installation files

    # and adjust the endpoints

    .\DeploySQLProvider.ps1 `

        -AzCredential $aadAdminCred `

        -VMLocalCredential $vmLocalAdminCred `

        -CloudAdminCredential $cloudAdminCred `

        -PrivilegedEndpoint $privilegedEndpoint `

        -DefaultSSLCertificatePassword $PfxPass `

        -DependencyFilesLocalPath $tempDir\cert

    First Script Error:

    PS>TerminatingError(): "Failed to deploy the SQLAdapter"
    PS>TerminatingError(): "Can not execute [C:\AzureStackOnAzureVM\SQLRP\Providers\Deploy-Microsoft-provider.ps1] command. The error: System.ArgumentException: Failed to deploy the SQLAdapter"

    Second Script from online documentations here https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-sql-resource-provider-deploy:

    second script error:

    Azure PowerShell Module with 2.3.0 version found, Need Azure powershell compatible with Stack, Use ArmProfile 2017-03-09-profile, Please Uninstall the current version and rerun the RP step

    (I tried uninstall Azure Module before but did not work)

    Any guidance?

    Tuesday, April 16, 2019 8:09 AM

All replies

  • This is a known issue with 1902, and we are working to align the PowerShell versions. Here is the GitHub issue where it is outlined, and rfsonders posts a workaround in the comments. 

    You will need to remove other modules, and install the requested version for the RP installation, then uninstall and reinstall the Azure Stack versions after. 

    Tuesday, April 16, 2019 8:48 PM
    Moderator
  • Can I get more details what is exactly (Azure or Azure Stack Module & which version) need to be uninstalled, and what is required to be installed instead? 
    Thursday, April 18, 2019 2:37 PM
  • What is the error you get when using the documentation's script?

    The script you posted here is missing some profile sets, and is likely outdated. Lets troubleshoot from the doc script. 

    Thursday, April 18, 2019 6:48 PM
    Moderator
  • I gave another try with Azure Stack version 1901 (to avoid 1902 that was reported that above error is know issue with 1902), however I got a new error when tried online latest documentation script https://docs.microsoft.com/en-us/azure-stack/operator/azure-stack-sql-resource-provider-deploy#deploy-the-sql-resource-provider-using-a-custom-script

    Log File:

    **********************
    Windows PowerShell transcript start
    Start time: 20190420153212
    Username: AZURESTACK\AzureStackAdmin
    RunAs User: AZURESTACK\AzureStackAdmin
    Machine: AzS-HOST1 (Microsoft Windows NT 10.0.14393.0)
    Host Application: C:\windows\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe
    Process ID: 16956
    PSVersion: 5.1.14393.2879
    PSEdition: Desktop
    PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14393.2879
    BuildVersion: 10.0.14393.2879
    CLRVersion: 4.0.30319.42000
    WSManStackVersion: 3.0
    PSRemotingProtocolVersion: 2.3
    SerializationVersion: 1.1.0.1
    **********************
    Transcript started, output file is C:\AzureStackOnAzureVM\SQLRP\Logs\DeploySQLProvider.ps1_20190420-153212.txt
    VERBOSE: 3:32:12 PM :
    VERBOSE: 3:32:12 PM : *************************************************
    VERBOSE: 3:32:12 PM : *Executing Script DeploySQLProvider.ps1 1.1.24.0*
    VERBOSE: 3:32:12 PM : *************************************************

    VERBOSE: PSBoundParameter are:
    VERBOSE: {
        "AzCredential":  {
                             "UserName":  "admin@MagAkhnoukoutlook.onmicrosoft.com",
                             "Password":  {
                                              "Length":  9
                                          }
                         },
        "VMLocalCredential":  {
                                  "UserName":  "sqlrpadmin",
                                  "Password":  {
                                                   "Length":  12
                                               }
                              },
        "CloudAdminCredential":  {
                                     "UserName":  "AzureStack\\cloudadmin",
                                     "Password":  {
                                                      "Length":  9
                                                  }
                                 },
        "PrivilegedEndpoint":  "AzS-ERCS01",
        "AzureEnvironment":  "AzureCloud",
        "DefaultSSLCertificatePassword":  {
                            "Length":  12
                                          },
        "DependencyFilesLocalPath":  "C:\\AzureStackOnAzureVM\\SQLRP\\cert"
    }
    VERBOSE: 3:32:12 PM :
    VERBOSE: 3:32:12 PM : ************************************************
    VERBOSE: 3:32:12 PM : *Checking for Azure Stack Powershell Module ...*
    VERBOSE: 3:32:12 PM : ************************************************
    Nuget Package provider found.
    Azure Powershell Module with 2.3.0 version found. Need Azure powershell compatible with stack. Use ArmProfile 2017-03-09-profile. Please uninstall the current version and rerun the RP setup
    PS>TerminatingError(): "ScriptHalted"
    VERBOSE: 3:32:12 PM :VERBOSE: 3:32:12 PM : ***************************************************************************************************************************************
    VERBOSE: 3:32:12 PM : *SQLAdapter installation failed. Check logfile C:\AzureStackOnAzureVM\SQLRP\Logs\DeploySQLProvider.ps1_20190420-153212.txt for details*
    VERBOSE: 3:32:12 PM : ***************************************************************************************************************************************
    PS>TerminatingError(DeploySQLProvider.ps1): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: ScriptHalted"
    **********************
    Windows PowerShell transcript end
    End time: 20190420153212
    **********************

    Saturday, April 20, 2019 3:52 PM
  • This is a similar error to the error you got with 1902, it is due to a PowerShell version mismatch. If you get your PowerShell versions correct for the install, you will not have an issue on either version. 

    To Uninstall all existing PowerShell Modules for Azure and Az:

    Get-Module -Name Azs.* -ListAvailable | Uninstall-Module -Force
    Get-Module -Name Azure* -ListAvailable | Uninstall-Module -Force
    Remove-Item 'C:\Program Files (x86)\WindowsPowerShell\Modules\Azure*' -Force
    Remove-Item 'C:\Program Files (x86)\WindowsPowerShell\Modules\Azs*' -Force

    Try the installation script. If it gives the same error, or says it needs the "ArmProfile 2017-03-09-profile" version, please let me know. 

    Once your SQL RP is installed, you will need to reinstall the Azure modules. 

    Install-Module AzureRM -RequiredVersion 2.4.0
    Install-Module -Name AzureStack -RequiredVersion 1.7.0

    Monday, April 22, 2019 9:05 PM
    Moderator