How to Dynamically Retrieve the HTTP URL of an
HTTP-Triggered Power Automate Flow
If you’ve ever needed to dynamically retrieve the HTTP URL
of a Power Automate flow with an HTTP trigger, this step-by-step guide will
help you create a solution to achieve that. We’ll use a flow that accepts two
input parameters (Environment ID and Flow ID), performs an HTTP request using
pre-authorized credentials, and generates a response containing the URL.
Step 1: Create a New Solution
- Navigate
to the Solutions section in Power Apps or Power Automate.
- Click New
Solution and provide:
- Name:
"GetHTTPFlowURL"
- Publisher: Select an existing publisher or create a new one.
- Save
and open the solution.
Step 2: Create an Instant Flow
- Inside
the solution, click New > Automation > Cloud Flow > Instant.
- Name
the flow (e.g., "GetHTTPFlowURL") and select the Manually
trigger a flow option.
- Add
the following input parameters:
- Environment
ID: Text input.
- Flow
ID: Text input.
Step 3: Add HTTP Request Action
- Add a
new action and search for HTTP with Azure in connectors. Select the preauthorized one.
- Configure connection reference as follows:
- Base URI: https://asia.api.flow.microsoft.com
- Resource URI: https://service.flow.microsoft.com
Note: The region of Base URI will be specific to your region. i.e. asia, unitedkingdom or emea. - Select
Sign In and configure the action as follows:
- Method:
POST
- URL:
https://asia.api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/@{triggerBody()['text']}/flows/@{triggerBody()['text_1']}/triggers/manual/listCallbackUrl?api-version=2016-11-01
- Headers:
Accept:
application/json
Step 4: Add a Response Action
- Add a Response
action after the HTTP request.
- Set
the Status Code to 200.
- In the
Body field, pass the body of the HTTP request:
@body('Invoke_an_HTTP_request')
- Use
the output schema from the HTTP response to define the structure:
"type": "object",
"properties": {
"response": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"method": {
"type": "string"
},
"basePath": {
"type": "string"
},
"queries": {
"type": "object",
"properties": {
"api-version": {
"type": "string"
}
}
}
}
},
"httpStatusCode": {
"type": "string"
}
}
}
Step 5: Test the Flow
- Save
and Test the flow.
- Provide
sample inputs for Environment ID and Flow ID.
- Verify
that the HTTP request retrieves the correct URL for the HTTP trigger in
the specified environment and flow.
Step 6: Deploy and Use the Flow
- Add
this flow to any automation scenario where you need to dynamically
retrieve the HTTP URL.
- Ensure proper permissions for users interacting with the flow.
Conclusion
This solution streamlines the retrieval of HTTP URLs for
HTTP-triggered flows, making it ideal for dynamic scenarios in complex
environments. By leveraging Power Automate's capabilities, you can automate
this process and integrate it seamlessly into your systems.
I am receiving this error while creating this flow:
ReplyDelete{
"error": {
"code": "ListCallbackUrlOperationBlocked",
"message": "The list callback url operation is blocked for triggers of type 'Request'."
}
}