Hi Team,
Getting error when run the below template through Azure build pipeline .
ssmstest.ps1 script available inside the Git repository but path not fetching from$(System.DefaultWorkingDirectory)
##[error]Error happened while initializing task: SyntaxError: Unexpected token a in JSON at position 230.
Could you please check below declared powershell ssmstest script path is correct? Please guide us to resolve this syntax error.
Below is the ARM template we are using :
{
“variables”: {
“client_id”:"{{env client_id
}}",
“client_secret”: “{{env client_secret
}}”,
“tenant_id”: “{{env tenant_id
}}”,
“current_path”: “{{env CURR_PATH
}}”,
“subscription_id”: “{{env subscription_id
}}”
},
“builders”: [{
“type”: “azure-arm”,
“client_id”: “{{user client_id
}}”,
“client_secret”: “{{user client_secret
}}”,
“resource_group_name”: “packtestrg”,
“storage_account”: “teststoragepacker”,
“temp_compute_name”:“myimagevm”,
“temp_resource_group_name”:“temprgpacker”,
“subscription_id”: “{{user subscription_id
}}”,
“tenant_id”: “{{user tenant_id
}}”,
“capture_container_name”: “images”,
“capture_name_prefix”: “packerimagetest”,
“os_type”: “Windows”,
“image_publisher”: “MicrosoftWindowsServer”,
“image_offer”: “WindowsServer”,
“image_sku”: “2019-Datacenter”,
“communicator”: “winrm”,
“winrm_use_ssl”: true,
“winrm_insecure”: true,
“winrm_timeout”: “30m”,
“winrm_username”: “administrator”,
"location": "Central US",
"vm_size": "Standard_DS2_v2"
}],
"provisioners":[
{
"type": "powershell",
"inline": [
"Import-Module ServerManager",
"Install-WindowsFeature -Name NET-Framework-Features",
"Install-WindowsFeature -Name telnet-client"
]
},
{
"type": "powershell",
"script": "{{user `current_path`}}\\ssmstest.ps1"
},
{
"type": "powershell",
"inline": [
"Add-WindowsFeature Web-Server",
"& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit /mode:vm",
"while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10 } else { break } }"
]
}
]
}