Logic app standard (single-tenant) - how to disable/enable workflow

Dmitriy Schurov 1 Reputation point
2022-08-18T11:07:00.487+00:00

I've tried to POST here
https://management.azure.com/subscriptions/{SubsID}/resourceGroups/{RG_Name}/providers/Microsoft.Web/sites/{AppName}/workflows/{WorkflowID}/disable?api-version=2022-03-01
But its not found. Is there any possible way to Enable and Disable Workflow using API?
And also - where the docs about all of APIs method regarding Workflows in Web Apps could be found?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,312 questions
{count} votes

4 answers

Sort by: Most helpful
  1. MayankBargali-MSFT 70,796 Reputation points
    2022-08-18T16:45:57.343+00:00

    @Dmitriy Schurov Thanks for reaching out. In case if you are looking for REST API to enable/disabled the standard logic app workflow.

    To Get all the Configuration for your standard logic app:
    POST
    https://management.azure.com/subscriptions/{subscription ID}/resourceGroups/{resource groupname}/providers/Microsoft.Web/sites/{logic app name}/config/appsettings/list?api-version=2018-11-01

    Once you have the response from the above REST API you need to add/update the properties object with Workflows.{yourworkflowName}.FlowState with Enabled or Disabled value
    with the below request. I have removed sensitive properties from the example below but you need to send the same properties along with the updating or adding the Workflows.{yourworkflowName}.FlowState

    Update the Configuration:
    PUT
    https://management.azure.com/subscriptions/{subscription ID}/resourceGroups/{resource groupname}/providers/Microsoft.Web/sites/{logic app name}/config/appsettings?api-version=2018-11-01

    Example: **
    {"id":"yourid","name":"appsettings","type":"Microsoft.Web/sites/config","location":"West US","properties":{"FUNCTIONS_EXTENSION_VERSION":"~3","FUNCTIONS_WORKER_RUNTIME":"node","WEBSITE_NODE_DEFAULT_VERSION":"~14","**Workflows.sbtest.FlowState
    ":"Enabled","Workflows.tets.FlowState":"Disabled"}}

    Feel free to get back to me if you need any assistance.

    1 person found this answer helpful.

  2. Martin Dimovski 1,626 Reputation points MVP
    2022-08-18T12:17:02.467+00:00

    Hi,

    Thank you for posting the question to the Q&A forum.

    Yes, there is the possibility to Enable/ Disable via API please check below :

    Enable: https://learn.microsoft.com/en-us/rest/api/logic/workflows/enable?tabs=HTTP

    Disable: https://learn.microsoft.com/en-us/rest/api/logic/workflows/disable?tabs=HTTP

    And also below you can find all API methods for the Workflow: https://learn.microsoft.com/en-us/rest/api/logic/workflows

    I hope the above information can help you.

    ****If the ANSWER is helpful, please click "Accept Answer" and upvote it. Thanks****


  3. Kamlesh Kumar 3,861 Reputation points
    2022-08-18T13:13:23.387+00:00

    Hi @Dmitriy Schurov ,

    Welcome to Microsoft Q&A Platform. Thank you for the question.

    The standard logic app is built on top of function runtime and it uses the same function REST API. The API is not yet available for consumption and therefore it is not documented as of now. For now, the workaround would be finding the REST API calls using the browser traces or fiddler traces that are initiated from the portal. For your reference sharing the REST calls as per your requirement and you need to pass the Authorization: Bearer <bearer-token> as documented here for any azure management REST call.

    Here you can have 2 approach,

    Using CLI Commands:

    az functionapp config appsettings set --name <StandardLogicAppName> --resource-group <ResourceGroupName> --settings Workflows.<WorkflowName>.FlowState=Disabled/Enabled  
      
    -- For Disabling the workflow  
    az functionapp config appsettings set --name poc2 --resource-group logicapp-rg --settings Workflows.teststateless.FlowState=Disabled  
      
    -- For Enabling the workflow  
    az functionapp config appsettings set --name poc2 --resource-group logicapp-rg --settings Workflows.teststateless.FlowState=Enabled  
    

    Using Rest API: Here you have to pass the Bearer <bearer-token>

    https://management.azure.com/subscriptions/<subscriptionsID>/resourceGroups/<ResourceGroupName>/providers/Microsoft.Web/sites/<StandardLogicAppName>/workflows/<WorkflowName>/disable?api-version=2015-08-01  
    

    Regards,
    Kamlesh Kumar

    Please don't forget to click on 205836-130616-image.png or upvote 205759-130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is How

    Want a reminder to come back and check responses? Here is how to subscribe to a Notification

    If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators


  4. GeeMan 1 Reputation point
    2022-09-23T02:36:17.05+00:00

    Just thought I'd share what worked for me as I'm a mediocre powershell user and whilst I write lots of powershell scripts, they're not at the advanced level. So whilst some stuff on this page helped, it's not complete enough for me.

    Add the following to powershell and run. Obviously after adding details to suit your tenant.

    I used PATCH because PUT wipes out all of your config.

    $ApplicationID = ""
    $TenatDomainName = ""
    $AccessSecret = ""

    $Body = @{
    Grant_Type = "client_credentials"
    resource = "https://management.azure.com/"
    client_Id = $ApplicationID
    Client_Secret = $AccessSecret
    }

    $ConnectGraph = Invoke-RestMethod -Uri "https://login.microsoftonline.com/$TenatDomainName/oauth2/token" -Method POST -Body $Body
    $token = $ConnectGraph.access_token

    $GraphUrl = "https://management.azure.com/subscriptions/{subscription ID}/resourceGroups/{resource groupname}/providers/Microsoft.Web/sites/{logic app name}/config/appsettings?api-version=2022-03-01" #PATCH

    $json = @"
    {
    "Properties": {
    "Workflows.workflowname.FlowState": "Disabled"
    }
    }
    "@

    Invoke-RestMethod -Method PATCH -Uri $GraphUrl -Headers @{Authorization = "Bearer $($token)"} -Body $json -ContentType "application/json"

    0 comments No comments

Your answer

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