I have been trying to deploy my bicep using parameters.json file privided in the inlineScript as shown below :
- name: deploy
uses: Azure/cli@v1
with:
azcliversion: "2.30.0"
inlineScript: |
az deployment group create \
--resource-group my-resource-group \
--name deploy-${{ github.run_id }} \
--template-file ./Deployment/test.bicep \
--parameters @./Deployment/azuredeploy.parameters.json \
But It keeps giving me a parse error
Starting script execution via docker image mcr.microsoft.com/azure-cli:2.30.0
ERROR: Unable to parse parameter: ./Deployment/azuredeploy.parameters.json
I have followed the instructions provided by github here and the error persists.
And my paramters json file is also correctly formatted :
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"value": "eastus"
},
"storageAccountName": {
"value": "yourstorageaccountname"
},
"publicNetworkAccess": {
"value": "Enabled"
},
"allowBlobPublicAccess": {
"value": true
},
"allowSharedKeyAccess": {
"value": true
},
"networkAclsDefaultAction": {
"value": "Allow"
},
"dnsEndpointType": {
"value": "Standard"
},
"keySource": {
"value": "Microsoft.Storage"
},
"encryptionEnabled": {
"value": true
},
"keyTypeForTableAndQueueEncryption": {
"value": "Account"
},
"infrastructureEncryptionEnabled": {
"value": false
},
"isContainerRestoreEnabled": {
"value": false
},
"containerSoftDeleteRetentionDays": {
"value": 7
},
"isShareSoftDeleteEnabled": {
"value": true
},
"shareSoftDeleteRetentionDays": {
"value": 7
}
}
}
And here is the complete workflow for better debugging:
name: Deploy MFT Core
on:
workflow_dispatch:
inputs:
main:
description: Flag to compile main.bicep. True by default.
required: false
default: true
type: boolean
spoke:
description: Flag to compile spoke.bicep. True by default.
required: false
default: true
type: boolean
notify:
description: "Notify of deployments"
required: true
type: boolean
default: false
enviroment:
description: "Environment"
required: true
type: environment
default: "test"
env:
LOCATION: "eastus"
jobs:
checkout-branch:
runs-on: ubuntu-latest
environment: ${{inputs.enviroment}}
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v2
with:
submodules: "true"
token: ${{ secrets.PLATFORM_PAT_TOKEN }}
build-and-deploy:
needs: checkout-branch
runs-on: ubuntu-latest
environment: ${{inputs.enviroment}}
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v2
with:
submodules: "true"
token: ${{ secrets.PLATFORM_PAT_TOKEN }}
- name: Setup Bicep
uses: anthony-c-martin/setup-bicep@v0.1
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
- name: deploy
uses: Azure/cli@v1
with:
azcliversion: "2.39.0"
inlineScript: |
az deployment group create \
--resource-group my-resource-group \
--name deploy-${{ github.run_id }} \
--template-file ./Deployment/test.bicep \
--parameters @./Deployment/azuredeploy.parameters.json \
deploy:
runs-on: ubuntu-latest
environment: ${{inputs.enviroment}}
steps:
# Log into Azure
- run: echo "Deploying to ${{vars.REGISTRY_LOGIN_SERVER}} environment"
If the path to parameters json file is incorrect it'd throw en error saying Unable to parse json
which is confusing and very misguiding while the actual cause is that the file doesn't exist on that path. Correcting the path-to-json file resolves the issue.