mattmcspirit / azurestack

Azure Stack Resources
80 stars 41 forks source link

The credential is invalid..Exception.Message #126

Closed caaustin74 closed 4 years ago

caaustin74 commented 4 years ago

Describe the issue [8:46 PM]::[HOSTCONFIGURATION]:: Disabling Windows Update on Infrastructure VMs and ASDK Host PS>TerminatingError(): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The credential is invalid." Azure Stack POC Configurator Stage: HostConfiguration failed. Updating AzSPoC Progress database The credential is invalid..Exception.Message


Windows PowerShell transcript end End time: 20200504204650

Hardware DL380 Gen9 58 cores 256 meg mem. 16 tb hd space.

Send the logs Zip up your ConfigASDK\Logs folder and send them to asdkconfigurator @ outlook .com and I'll analyze them as quickly as possible.

Additional context Add any other context about the problem here.

mattmcspirit commented 4 years ago

Hey - so in the 'Host Configuration' section, it runs the following:

# Disable Windows Update on infrastructure VMs
Write-CustomVerbose -Message "Disabling Windows Update on Infrastructure VMs and ASDK Host`r`n"
$AZSvms = Get-VM -Name AZS*
$scriptblock = {
     Get-Service -Name wuauserv | Stop-Service -Force -PassThru | Set-Service -StartupType disabled -Confirm:$false
}
foreach ($vm in $AZSvms) {
Invoke-Command -VMName $vm.name -ScriptBlock $scriptblock -Credential $asdkAdminCreds
}

The key here is, the $asdkAdminCreds, which must have been incorrect. These are the creds that you used when you deployed the ASDK host, and should be "AzureStack\AzureStackAdmin" with the accompanying password.

That's the only reason this step would fail.

When you run the script, the -asdkHostPwd 'Passw0rd123!' must have been incorrect.

Thanks!

caaustin74 commented 4 years ago

Yes this is a bit strange. I am logged into the asdk host with azurestack\azurestackadmin so I have the credentials. I used the same credentials variable to login to the PEP:

Enter-PSSession -ComputerName "AzS-ERCS01" -ConfigurationName PrivilegedEndpoint -Credential $asdkad mincreds VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\PackageManagement.psd1'. VERBOSE: Importing cmdlet 'Find-Package'. VERBOSE: Importing cmdlet 'Find-PackageProvider'. VERBOSE: Importing cmdlet 'Get-Package'. VERBOSE: Importing cmdlet 'Get-PackageProvider'. VERBOSE: Importing cmdlet 'Get-PackageSource'. VERBOSE: Importing cmdlet 'Import-PackageProvider'. VERBOSE: Importing cmdlet 'Install-Package'. VERBOSE: Importing cmdlet 'Install-PackageProvider'. VERBOSE: Importing cmdlet 'Register-PackageSource'. VERBOSE: Importing cmdlet 'Save-Package'. VERBOSE: Importing cmdlet 'Set-PackageSource'. VERBOSE: Importing cmdlet 'Uninstall-Package'. VERBOSE: Importing cmdlet 'Unregister-PackageSource'. VERBOSE: Looking up shared vhd product drive letter. WARNING: Unable to find volume with label Deployment VERBOSE: Get-Package returned with Success:True VERBOSE: Found package Microsoft.AzureStack.Solution.Deploy.EnterpriseCloudEngine.Client.Deployment with version 1.2002.0.35 at C:\NugetStore\Microsoft.AzureStack.Solution.Deploy.EnterpriseCloudEngine.Client.Deployment.1.2002.0.35\Microsoft.AzureS tack.Solution.Deploy.EnterpriseCloudEngine.Client.Deployment.nuspec. WARNING: The names of some imported commands from the module 'ECEClient' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.

I pipe those same credentials to the commands you listed above and they don't work.

mattmcspirit commented 4 years ago

So for the PEP, the creds are always azurestack\cloudadmin (for the ASDK).

If you open up Hyper-V Manager, and select one of the VMs, you could be able to connect to it, and try to log in with azurestack\azurestackadmin, and your password. Then you'll know whether the creds are right for the VMs or not. I've not seen an instance where the VM creds are different to that of the ASDK host, so it would be strange.

Also, when calling the script, make sure for the -asdkHostPwd, you're using single quotes 'pass@#$%' rather than double quotes, as that can sometimes cause issues with special escape characters in PowerShell.

caaustin74 commented 4 years ago

Yes I can login to the ECS VM with the same credentials.

mattmcspirit commented 4 years ago

Right, so in a fresh PS/ISE window, if you run the following:

$asdkTestAdminUsername = "AzureStack\AzureStackAdmin"
$secureTestAsdkHostPwd = Read-Host "Please enter the password used for the ASDK Host Deployment, for account AzureStack\AzureStackAdmin" -AsSecureString -ErrorAction Stop
$asdkTestAdminCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $asdkTestAdminUsername, $secureTestAsdkHostPwd -ErrorAction Stop
                $AZSvms = Get-VM -Name AZS*
                $scriptblock = {
                    Get-Service -Name wuauserv | Stop-Service -Force -PassThru | Set-Service -StartupType disabled -Confirm:$false
                }
                foreach ($vm in $AZSvms) {
                    Invoke-Command -VMName $vm.name -ScriptBlock $scriptblock -Credential $asdkTestAdminCreds
                }

Does this fail? If so, I'm stumped - this is basic PS, unrelated to Azure Stack, and there's no reason why it shouldn't work. I haven't seen any environments where this has happened.

caaustin74 commented 4 years ago

Yes that doesn't work so I think I'm going to re-bake the asdk load. Thank you for your help.

mattmcspirit commented 4 years ago

Hopefully a redeployment will work fine - seems such a strange error. Let me know if the same happens again and we can always have a screen share session. Thanks!