A step in the first job calls a bicep script file to create a vnet (Virtual Network). The bicep creates the vnet and a number of subnets together with vnet ID and outputs them to the caller. Here are the types and sample info that the bicep returns:
Sample frontendSubnet info
{"name":"backendSubnet","id":"/*****/resourceGroups/GithubWorkflowIssue/providers/Microsoft.Network/virtualNetworks/vnet-cosmo-epvypfxupyhic/subnets/backendSubnet","etag":"W/\"40085f0c-f1c4-4bd2-93a5-d9ddf8f40834\"","properties":{"provisioningState":"Succeeded","addressPrefix":"10.0.1.0/24","delegations":[],"privateEndpointNetworkPolicies":"Disabled","privateLinkServiceNetworkPolicies":"Enabled"},"type":"Microsoft.Network/virtualNetworks/subnets"}
The issue is that the deploy step does not dispatch those parameters correctly and Azure ARM cannot interpret them and throws errors as shown below. It looks like it has trouble with "object" types and multiple "/" in strings. I have created a simplified version of the situation here where you can experiment for yourself, just make sure to change the "resourceGroupName" in "workflow.yaml" and also set up your Azure application and Githup to Azure federated credentials:
https://github.com/gary-RR/github_workflow_issues
Errors in Azure deployment logs
Run azure/arm-deploy@v1
with:
deploymentName: 6
resourceGroupName: GithubWorkflowIssue
template: ./deploy/azure_sql_private_endpoint.bicep
parameters: vnetId= frontendSubnet= backendSubnet=
Validating template...
Warning: ERROR: Failed to parse string as JSON:
Error detail: Expecting value: line 1 column 1 (char 0)
Warning: Template validation failed.
Creating deployment...
Error: ERROR: Failed to parse string as JSON:
Error detail: Expecting value: line 1 column 1 (char 0)
I have a workflow that consists of two jobs:
Job1:
A step in the first job calls a bicep script file to create a vnet (Virtual Network). The bicep creates the vnet and a number of subnets together with vnet ID and outputs them to the caller. Here are the types and sample info that the bicep returns:
output frontendSubnet object=vnet.properties.subnets[0] output backendSubnet object=vnet.properties.subnets[1] output vnetId string=vnet.id
Sample frontendSubnet info {"name":"backendSubnet","id":"/*****/resourceGroups/GithubWorkflowIssue/providers/Microsoft.Network/virtualNetworks/vnet-cosmo-epvypfxupyhic/subnets/backendSubnet","etag":"W/\"40085f0c-f1c4-4bd2-93a5-d9ddf8f40834\"","properties":{"provisioningState":"Succeeded","addressPrefix":"10.0.1.0/24","delegations":[],"privateEndpointNetworkPolicies":"Disabled","privateLinkServiceNetworkPolicies":"Enabled"},"type":"Microsoft.Network/virtualNetworks/subnets"}
Sample vnetId /subscriptions/*****/resourceGroups/GithubWorkflowIssue/providers/Microsoft.Network/virtualNetworks/vnet-cosmo-epvypfxupyhic
Job 2:
The outputs from the step in job 1 are used to call another bicep script:
template: ./deploy/azure_sql_private_endpoint.bicep parameters: > vnetId=${{ needs.deploy-vnet.outputs.vnetId }} frontendSubnet=${{ needs.deploy-vnet.outputs.frontendSubnet }} backendSubnet=${{ needs.deploy-vnet.outputs.backendSubnet }}
The issue is that the deploy step does not dispatch those parameters correctly and Azure ARM cannot interpret them and throws errors as shown below. It looks like it has trouble with "object" types and multiple "/" in strings. I have created a simplified version of the situation here where you can experiment for yourself, just make sure to change the "resourceGroupName" in "workflow.yaml" and also set up your Azure application and Githup to Azure federated credentials: https://github.com/gary-RR/github_workflow_issues
Errors in Azure deployment logs Run azure/arm-deploy@v1 with: deploymentName: 6 resourceGroupName: GithubWorkflowIssue template: ./deploy/azure_sql_private_endpoint.bicep parameters: vnetId= frontendSubnet= backendSubnet=
Validating template... Warning: ERROR: Failed to parse string as JSON:
Error detail: Expecting value: line 1 column 1 (char 0)
Warning: Template validation failed. Creating deployment... Error: ERROR: Failed to parse string as JSON:
Error detail: Expecting value: line 1 column 1 (char 0)