Set Host URL

Template ID: dynamichosturl

Replaces host URL with the URL generated from the template. This template is available in Power Apps and Power Automate.

In this article

The target use cases for this template are scenarios where the request has to be routed to a backend host url which is dynamic and depends on one or more connection parameters, query parameters or headers. The URL template parameter supports expressions to enable this scenario and the operations parameter allows you to scope down the application to a specific subset of operations if needed.

If you use this template, please keep in mind that the host url defined in the connector will no longer be relevant for the correspinding operations since it will always be replaced by the value evaluated by this template.

Note that this policy currently does not support Gateway urls.

Examples

Let’s look at some examples that use the following parameters.

headers: test=foo; port=1234

connectionParameters: cat=bar; subPath=path

queryParameters: domain=pqr

Url TemplateResulting host url
https://@header('test').abc.xyz:@header('port')https://foo.abc.xyz:1234
https://@connectionParameters('cat').abc.xyzhttps://bar.abc.xyz
https://test.abc.xyzhttps://test.abc.xyz
https://@header('test').abc.@queryParameters('domain')/@connectionParameters('subPath')https://foo.abc.pqr/path
https://@header('test123', 'default').abc.xyzhttps://default.abc.xyz

Examples from open-sourced connectors

We have multiple instances of this template being used in our open-sourced connectors repository.

ConnectorScenario
Key VaultHost URL depends on the key vault name which is a connection parameter
Engagement CloudHost URL depends on the region which is passed as a header
Cognitive Service Text AnalyticsHost URL is supplied by the user as a connection parameter but also has a default

Input Parameters

Name Key Required Type Description
Url Template x-ms-apimTemplateParameter.urlTemplate True String Specifies template from which host URL will be generated. This parameter supports expressions. Click here to learn more about expressions.
Operations x-ms-apimTemplate-operationName Array List of actions and triggers to which the policy will apply to. If no operation is selected, this policy will apply to all operations.