mattmcspirit / azurestack

Azure Stack Resources
80 stars 41 forks source link

AddServerFull2016Image and DeployAppService failed #120

Closed Zamilshaon closed 4 years ago

Zamilshaon commented 4 years ago

Hi Matt,

** Please wait until all jobs have completed/failed before re-running the main script ** At least one of the jobs failed. FAILED JOB: Job Name: AddServerFull2016Image | Error Message: Creating a Windows Server (ServerFull.2016.40.20200323.vhd) image failed after 3 attempts. Check the logs then retry. Exitingprocess. FAILED JOB: Job Name: DeployAppService | Error Message: Deploying the App Service Resource Provider failed after 3 attempts. Check the logs and rerun the script [12:44 AM]::[LAUNCHJOBS]:: Please review the logs for further troubleshooting.Exception.Message

I am running the script as bellow,

.\AzSPoC.ps1 -azureDirectoryTenantName "xxx.onmicrosoft.com" -authenticationType AzureAD -downloadPath "D:\AzSPoC_Deploy" -ISOPath "C:\ISO_WS2016_EV\WS2016EVALISO.iso" -asdkHostPwd 'xxxx' -VMpwd 'xxxx' -azureAdUsername "xxx@xxx.onmicrosoft.com" -azureAdPwd 'xxxx' ` -registerAzS -useAzureCredsForRegistration -azureRegSubId "5fxxxxx-b0cb-xxxx-9d6b-dxxxxxxa0"

Note: The script folder is in C:\AzSPoC and downloadPath and ISO path is in D: drive

Sending you the logs Please check both dates (folder) The second try fails on 2 jobs as mentioned in the title

Best, Zamil

mattmcspirit commented 4 years ago

Hi,

It looks from the logs that you had a Windows Server 2016 image already downloaded in your gallery - is that true? From the logs:

WS Full: /providers/Microsoft.Compute.Admin/locations/local/artifactTypes/platformImage/publishers/MicrosoftWindowsServer/offers/WindowsServer/skus/2016-Datacenter/versions/2016.127.20200131'

WS Core: /providers/Microsoft.Compute.Admin/locations/local/artifactTypes/platformImage/publishers/MicrosoftWindowsServer/offers/WindowsServer/skus/2016-Datacenter-Server-Core/versions/2016.127.20200131'

Did you download one, then remove it while my script was running, or something else?

Zamilshaon commented 4 years ago

Hi,

Thanks for the quick reply! Yes, I have downloaded Windows Server 2016 image after the ASDK deployment. Deleting the image and will try your script again. Will get beck with update......

mattmcspirit commented 4 years ago

That won't fix it - you will need to reset the Windows Update stage of the process first. When you ran the script before, during the WindowsUpdate step, my script detected that you had a Windows Server Core and Windows Server Full image, so it didn't download any updates.

However, when my ServerFull2016Image step ran, it didn't detect the existing Windows Server Full image, but because the updates hadn't been downloaded, it didn't run. I'm not sure why it did that, but i'll check for that going forward.

I'm confused though, your launch command above looks like this:

.\AzSPoC.ps1 -azureDirectoryTenantName "xxx.onmicrosoft.com" -authenticationType AzureAD -downloadPath "D:\AzSPoC_Deploy" -ISOPath "C:\ISO_WS2016_EV\WS2016EVALISO.iso" -asdkHostPwd 'xxxx' -VMpwd 'xxxx' -azureAdUsername "xxx@xxx.onmicrosoft.com" -azureAdPwd 'xxxx' ` -registerAzS -useAzureCredsForRegistration -azureRegSubId "5fxxxxx-b0cb-xxxx-9d6b-dxxxxxxa0"

You have told it to register the ASDK, but wasn't it already registered, seeing as you have downloaded images from the marketplace, or did you download them while my script was running?

Anyway, you'll need to run this before you run the script (assuming you do not have a Windows Server 2016 Full image downloaded:

$sqlServerInstance = '(localdb)\MSSQLLocalDB'
$databaseName = "AzSPoC"
$tableName = "Progress"
$progressStage = "WindowsUpdates"

Invoke-Sqlcmd -Server $sqlServerInstance -Query "USE $databaseName UPDATE Progress SET $progressStage = 'Incomplete';" -Verbose:$false -ErrorAction Stop
Read-SqlTableData -ServerInstance $sqlServerInstance -DatabaseName "$databaseName" -SchemaName "dbo" -TableName "$tableName" -ErrorAction SilentlyContinue -Verbose:$false

This will/should download the correct updates for your Windows Images and then build the Windows Server 2016 Full image...

Zamilshaon commented 4 years ago

Sorry, I forgot to mention it earlier, I registered my ASDK with Azure and downloaded some images from the Marketplace before I ran your script. Then I ran a power-shell script to un-register it from Azure and deleted the RG from Azure and started your script again. After deleting just the image from Marketplace the script worked. Didn't need to run the script above. The deployment succeeded. Thanks a lot!

mattmcspirit commented 4 years ago

Great - glad it worked!