I wanted to disable all the logic app workflows in a resource group. I re-searched and I could find only Set-AzLogicApp and the state of that can be enabled or disabled. Then Thought of using this REST API endpoint
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{logicappName}/workflows/{workflowName}/disable?api-version=2016-06-01. When I use this command in my powershell command it throws an error "Please run 'az login' to setup account". If I use the az login command the pipeline in running on and on. So someone can help me on how to use the above command properly inside a powershell script.
My script is :
param(
[string]
$region,
[string]
$environment,
[string]
$subscriptionId,
[string]
$component
)
$resourceGroupName = "hip-core-$($region)-$($environment)"
$componentFullName = "la-$($component)-$($region)-$($environment)"
Write-Host "Resource group '$resourceGroupName' ";
Write-Host "Logic App Name '$componentFullName' ";
Write-Host "Getting subscription Id.....";
Set-AzContext -Subscription $subscriptionId
#Getting a specific workflow
$workflowjson = az rest --method GET --uri https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{logicappname}/workflows/{workflowName}?api-version=2016-06-01
$workflows = $workflowsjson | ConvertFrom-Json
$workflowFullName = $_.Name