Share via

Biceparam files

prasantc 996 Reputation points
2023-07-20T03:14:01.2966667+00:00

It is easier to pass new .bicepparam files as it supports commenting against JSON param file. One limitation I see is pointing it to only one source module and passing it multiple times.

I wonder if there is any tool that converts bicepparm to json or text and allow parsing and pass it at module level.

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.


2 answers

Sort by: Most helpful
  1. Bryan Trach 17,842 Reputation points Microsoft Employee Moderator
    2023-08-10T00:18:11.86+00:00

    @prasantc To follow up to your question, to my knowledge, there is no built-in function in Bicep that allows you to convert a Bicep parameter file to JSON or text. However, you can use the loadTextContent function to load the contents of a Bicep parameter file as a string, and then parse it using a JSON parser or other text processing tools.

    For example, you can use the following code to load the contents of a Bicep parameter file as a string:

    var paramContent = loadTextContent('path/to/params.bicep');
    

    You can then use a JSON parser to parse the string into a JSON object:

    var paramObject = JSON.parse(paramContent);
    

    Once you have the JSON object, you can pass it to your module as a parameter.

    I hope this helps. Let me know if you have any further questions or concerns.

    Was this answer helpful?

    0 comments No comments

  2. Shweta Mathur 30,456 Reputation points Microsoft Employee Moderator
    2023-07-20T08:15:12.81+00:00

    Hi @prasantc ,

    Thanks for reaching out.

    You can use MSBuild to convert a Bicep file to JSON.

    Reference -https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/msbuild-bicep-file?tabs=dotnet#convert-bicep-to-json

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.