Skip to content

Bug in passing certain parameter types using "azure/arm-deploy@v1" to an Azure bicep file #169

@gary-RR

Description

@gary-RR

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:

  • uses: azure/arm-deploy@v1
    name: Run preflight validation
    with:
    deploymentName: ${{ github.run_number }}
    resourceGroupName: ${{ inputs.resourceGroupName }}
    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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions