0

I'm trying to find a way to get the parameters.json of a logic app standard single-tenant using and I can't find any.

I know that the command Get-AzLogicApp exists but it works only for logic app consumption multi-tenant.

The command I found that can be used with standard is

$resource = Get-AzResource `
    -ResourceGroupName "resourceGroupName" `
    -ResourceType 'Microsoft.Web/sites' `
    -Name "logicAppName"

The returned object doesnt give any property related with parameters.json. Is there any other way that with powershell we can access it?

Nmaster88
  • 1,405
  • 2
  • 23
  • 65

1 Answers1

0

One way that you can do is to download the template file which contains parameter file too using Export-AzResourceGroup. Below is the script that worked for me.

$resource = Get-AzResource -ResourceGroupName "<YOUR_RESOUREGROUP_NAME>" -ResourceType 'Microsoft.Web/sites' -Name "<YOUR_LOGICAPP_NAME>"
$resource.ResourceId

Export-AzResourceGroup -ResourceGroupName '<YOUR_RESOUREGROUP_NAME>' -Resource $resource.ResourceId -IncludeParameterDefaultValue -Force

However, if you want to retrieve only parameter file, you can use the below script that worked fine when reproduced from my end.

$resource = Get-AzResource -ResourceGroupName "<YOUR_RESOUREGROUP_NAME>" -ResourceType 'Microsoft.Web/sites' -Name "<YOUR_LOGICAPP_NAME>"
$resource.ResourceId

Export-AzResourceGroup -ResourceGroupName '<YOUR_RESOUREGROUP_NAME>' -Resource $resource.ResourceId -IncludeParameterDefaultValue -Force

$fileContent = Get-Content -Path '<PATH_TO_EXPORTED_FILE>' | ConvertFrom-Json

$schema = '"'+"`$schema"+'"'+":"+'"'+$fileContent.'$schema'+'"'
$contentVersion = '"'+"contentVersion"+'"'+":"+'"'+$fileContent.contentVersion+'"'
$parameter = $fileContent.parameters | ConvertTo-Json
$parameters = '"'+"parameters"+'"'+":"+$parameter

$parameterFile = $schema+","+$contentVersion+","+$parameters

$parameterFileJson = "{"+$parameterFile+"}" | ConvertFrom-Json | ConvertTo-Json 

$parameterFileJson | Out-File '<PATH>/parameters.json'

Results:

enter image description here

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18