stgeorgi / wvdquickstart

26 stars 31 forks source link

Template parameter JToken type is | not valid. Expected 'String, Uri'. Actual 'Object'. error #9

Closed StevenReid closed 4 years ago

StevenReid commented 4 years ago

Hi, First off. An amazing project! Saves soo much time.

At the moment, when I run the job to create for a new AD, I receive this error at the Deploy_WVDSessionHosts - Deploy module (VirtualMachines) step in the pipeline.

VERBOSE: Deploy to resource group 'WVD_Test' VERBOSE: GET https://raw.githubusercontent.com/stgeorgi/wvdquickstart/master/Modules/ARM/VirtualMachines/deploy.json with 0-byte payload VERBOSE: received 66423-byte response of content type text/plain VERBOSE: Content encoding: utf-8 VERBOSE: Evaluating schema [https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#] VERBOSE: Handling resource group level deployment VERBOSE: Performing the operation "Creating Deployment" on target "WVD_Test". New-AzResourceGroupDeployment: /home/vsts/work/1/s/SharedDeploymentFunctions/Invoke-GeneralDeployment.ps1:76 Line | 76 | … eployment = New-AzResourceGroupDeployment @DeploymentInputs -Resource … | ~~~~~~~~~~~~~ | 23:28:21 - Error: Code=InvalidTemplate; Message=Deployment | template validation failed: 'Template parameter JToken type is | not valid. Expected 'String, Uri'. Actual 'Object'. Please see | https://aka.ms/resource-manager-parameter-files for usage | details.'.

Am I doing something wrong.

Hopminonther commented 4 years ago

+1, I also get this notification. I did change the default image though as can be seen in this log output:

2020-09-26T11:51:02.5158144Z ##[section]Starting: Deploy module [VirtualMachines] in [rg-WVD-CUR] via [WVDServiceConnection] 2020-09-26T11:51:02.5166246Z ============================================================================== 2020-09-26T11:51:02.5166578Z Task : Azure PowerShell 2020-09-26T11:51:02.5166856Z Description : Run a PowerShell script within an Azure environment 2020-09-26T11:51:02.5167116Z Version : 4.175.1 2020-09-26T11:51:02.5167336Z Author : Microsoft Corporation 2020-09-26T11:51:02.5167626Z Help : https://aka.ms/azurepowershelltroubleshooting 2020-09-26T11:51:02.5167940Z ============================================================================== 2020-09-26T11:51:02.7579923Z ## Validating Inputs 2020-09-26T11:51:02.7693600Z ## Validating Inputs Complete 2020-09-26T11:51:02.7693833Z ## Initializing Az module 2020-09-26T11:51:02.7710543Z Generating script. 2020-09-26T11:51:02.7720923Z ## Az module initialization Complete 2020-09-26T11:51:02.7721311Z ## Beginning Script Execution 2020-09-26T11:51:02.7752952Z [command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/home/vsts/work/_temp/bbbbbbbb-bbbb-bbbb-bbbbbbbbbbbb.ps1' 2020-09-26T11:51:04.5957907Z ##[command]Import-Module -Name /home/vsts/.local/share/powershell/Modules/Az.Accounts/1.9.4/Az.Accounts.psd1 -Global 2020-09-26T11:51:05.2824818Z ##[command]Clear-AzContext -Scope Process 2020-09-26T11:51:05.6634089Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue 2020-09-26T11:51:06.5969057Z ##[command]Connect-AzAccount -ServicePrincipal -Tenant -Credential System.Management.Automation.PSCredential -Environment AzureCloud @processScope 2020-09-26T11:51:08.0726786Z ##[command] Set-AzContext -SubscriptionId aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa -TenantId 2020-09-26T11:51:08.6829441Z VERBOSE: Load function 2020-09-26T11:51:08.6926892Z VERBOSE: Invoke task with 2020-09-26T11:51:08.6975396Z VERBOSE: PARAMETER: 'location' with value 'eastus' 2020-09-26T11:51:08.6980854Z VERBOSE: PARAMETER: 'moduleName' with value 'VirtualMachines' 2020-09-26T11:51:08.6985870Z VERBOSE: PARAMETER: 'resourcegroupName' with value 'rg-WVD-CUR' 2020-09-26T11:51:08.6988197Z VERBOSE: PARAMETER: 'parameterFilePath' with value '/home/vsts/work/1/parameters/wvdsessionhost.parameters.json' 2020-09-26T11:51:08.6990971Z VERBOSE: PARAMETER: 'moduleVersion' with value '2020-06-02' 2020-09-26T11:51:08.6992969Z VERBOSE: Fetch and populated pipeline outputs 2020-09-26T11:51:10.5316631Z VERBOSE: Using custom image ref ['/subscriptions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/resourceGroups/RG_WVD_AzureImageBuilder/providers/Microsoft.Compute/galleries/WVDSharedGallery01/images/WVDImage2004/versions/1.0.1'] 2020-09-26T11:51:13.1391814Z VERBOSE: Parameters are 2020-09-26T11:51:13.2206554Z VERBOSE: 2020-09-26T11:51:13.2207333Z Name Value 2020-09-26T11:51:13.2208494Z ---- ----- 2020-09-26T11:51:13.2209100Z availabilitySetName
2020-09-26T11:51:13.2209656Z eventHubName
2020-09-26T11:51:13.2211177Z vmNamePrefix QS-WVD-VM 2020-09-26T11:51:13.2212093Z vmNumberOfInstances 2 2020-09-26T11:51:13.2215109Z osDisk @{createOption=fromImage; diskSizeGB=128; managedDisk=} 2020-09-26T11:51:13.2219871Z vmSize Standard_D2s_v3 2020-09-26T11:51:13.2220344Z eventHubAuthorizationRuleId
2020-09-26T11:51:13.2220815Z domainJoinOU
2020-09-26T11:51:13.2221369Z dscConfiguration @{settings=; protectedSettings=} 2020-09-26T11:51:13.2221772Z diagnosticStorageAccountId
2020-09-26T11:51:13.2222132Z domainJoinUser someuser@ 2020-09-26T11:51:13.2222935Z domainJoinPassword
2020-09-26T11:51:13.2223267Z workspaceId
2020-09-26T11:51:13.2223709Z lockForDeletion False 2020-09-26T11:51:13.2225552Z domainName vanityname.nl 2020-09-26T11:51:13.2226020Z subnetId subscriptions/e... 2020-09-26T11:51:13.2227249Z tags
2020-09-26T11:51:13.2227757Z enablePublicIP False 2020-09-26T11:51:13.2228112Z adminPassword
2020-09-26T11:51:13.2228463Z diagnosticLogsRetentionInDays 365 2020-09-26T11:51:13.2228814Z adminUsername someusername 2020-09-26T11:51:13.2229687Z imageReference @{id=; publisher=MicrosoftWindowsDesktop; offer=office-365; sku=2… 2020-09-26T11:51:13.2230796Z windowsScriptExtensionFileData {@{uri=https://assets0925t134724z.blob.core.windows.net/wvdscripts/scriptExtensionMaster… 2020-09-26T11:51:13.2231317Z vmInitialNumber 1 2020-09-26T11:51:13.2231864Z 2020-09-26T11:51:13.2232096Z 2020-09-26T11:51:13.2232402Z VERBOSE: Additional Parameters are 2020-09-26T11:51:13.2232753Z VERBOSE: 2020-09-26T11:51:13.2233045Z Name Value 2020-09-26T11:51:13.2233609Z ---- ----- 2020-09-26T11:51:13.2233993Z imageReference {id} 2020-09-26T11:51:13.2234651Z windowsScriptExtensionCommand… System.Security.SecureString 2020-09-26T11:51:13.2234980Z 2020-09-26T11:51:13.2235192Z 2020-09-26T11:51:13.2235655Z VERBOSE: Deploy to resource group 'rg-WVD-CUR' 2020-09-26T11:51:13.2277163Z VERBOSE: GET https://raw.githubusercontent.com/stgeorgi/wvdquickstart/master/Modules/ARM/VirtualMachines/deploy.json with 0-byte payload 2020-09-26T11:51:13.6049377Z VERBOSE: received 66423-byte response of content type text/plain 2020-09-26T11:51:13.6326528Z VERBOSE: Content encoding: utf-8 2020-09-26T11:51:13.6395128Z VERBOSE: Evaluating schema [https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#] 2020-09-26T11:51:13.6406095Z VERBOSE: Handling resource group level deployment 2020-09-26T11:51:14.9264127Z VERBOSE: Performing the operation "Creating Deployment" on target "rg-WVD-CUR". 2020-09-26T11:51:17.7197871Z New-AzResourceGroupDeployment: /home/vsts/work/1/s/SharedDeploymentFunctions/Invoke-GeneralDeployment.ps1:76 2020-09-26T11:51:17.7199296Z Line | 2020-09-26T11:51:17.7200436Z  76 |  … eployment = New-AzResourceGroupDeployment @DeploymentInputs -Resource … 2020-09-26T11:51:17.7201288Z  |  ~~~~~~~~~~~~~ 2020-09-26T11:51:17.7201863Z  | 11:51:17 - Error: Code=InvalidTemplate; Message=Deployment 2020-09-26T11:51:17.7202408Z  | template validation failed: 'Template parameter JToken type is 2020-09-26T11:51:17.7202934Z  | not valid. Expected 'String, Uri'. Actual 'Object'. Please see 2020-09-26T11:51:17.7203430Z  | https://aka.ms/resource-manager-parameter-files for usage 2020-09-26T11:51:17.7203911Z  | details.'. 2020-09-26T11:51:17.7204174Z  2020-09-26T11:51:17.7438632Z ##[error]PowerShell exited with code '1'. 2020-09-26T11:51:17.7461129Z ## Script Execution Complete 2020-09-26T11:51:17.7468692Z ##[section]Finishing: Deploy module [VirtualMachines] in [rg-WVD-CUR] via [WVDServiceConnection]

BGreeneGIS commented 4 years ago

Had the same issue. Found the latest version of Azure PowerShell v.4.7.0 breaks the deployment. Adding/modifying the following lines to the Deploy_WVDSessionHosts and Deploy_Workspace tasks of pipeline.yml file worked for me.

azurePowerShellVersion: OtherVersion preferredAzurePowerShellVersion: 3.5.0

StevenReid commented 4 years ago

azurePowerShellVersion: OtherVersion preferredAzurePowerShellVersion: 3.5.0

Hi BGreeneGIS, Apologies for a silly question. just getting on this DevOps knowledge path.. Is this changing the file /QS-WVD/pipeline.yml image

and then going to the Pipelines area and rerunning the Failed Jobs? Or do i need to do something else?

stgeorgi commented 4 years ago

@StevenReid from what I see yes

StevenReid commented 4 years ago

@StevenReid from what I see yes

@stgeorgi I tried to just rerun the failed jobs, but that didnt work, as it continued to use the old files. I went into the repo and ran 'Set up build' and that worked.