Edit template.ps1 with frontend input fields

Coelho, Joao 1 Reputation point

I'm trying to edit a template.ps1 file to do deployments on Azure, but I can't find a way to edit it to have the frontend fields.

This is my template.ps1:

$rg = 'frontend-name-field'  
New-AzResourceGroupDeployment `  
    -Name 'new-storage' `  
    -ResourceGroupName $rg `  
    -TemplateFile 'Storage.json'  
New-AzResourceGroupDeployment `  
    -Name 'new-Appinsights' `  
    -ResourceGroupName $rg `  
    -TemplateFile 'AppInsightsDeploy.json' `  
    -TemplateParameterFile 'AppInsightsDeploy.parameters.json' `  

This is my frontend form:

I tried converting the template to json using ConvertTo-JSON, but it was unsuccessful.

I have a JavaScript file that gets the frontend inputs, so I'm trying to find a way to edit the template.

Any idea on how I can edit the template.ps1 so the $rg field is the one from "Resource Group" field in the frontend?

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,183 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 43,316 Reputation points

    Hello there,

    What is the error message you are getting when you try to converting the template to json?

    You can customize this script to meet your deployment requirements by editing it in the Windows PowerShell ISE application.There is no support for the ISE in PowerShell v6 and beyond. Users looking for replacement for the ISE should use Visual Studio Code with the PowerShell Extension.


    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments