How to use backend and string to give me base-url in backend-service policy?

Martin Kallukalam 540 Reputation points
2024-06-15T12:32:31.46+00:00

I have an mtls backend defined: mtlsbackend https://middleware.contoso.com

I want to use in inbound policy an expression which will evaluate to

https://middleware.contoso.com/service1 using a policy such as

<set-backend-service base-url="base URL of the backend service" />

How do I use a variable expression using backend and string (service1) to set base-url?

PS: I do not want to define my backend as https://middleware.contoso.com/service1 because I will have 100s of service which will use the backend. Hence not scalable to define a backend for every fqdn/service.
Instead I want to define backend as fqdn and then use expression to give me base-url

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
{count} votes

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 29,436 Reputation points Moderator
    2024-06-17T12:11:31.5666667+00:00

    @Martin Kallukalam Thanks for reaching out. From the description i understand that you would need to set the base URL of the backend in the set-backend-service policy from the backend section and append it with a string dynamically using an expression in an inbound policy correct me if i am wrong hereUser's image If it is the above case, then unfortunately we don't have a way to retrieve the backend information currently please refer the supported policy expressions: https://learn.microsoft.com/en-us/azure/api-management/api-management-policy-expressions#ContextVariables.

    Feel free to leave your feedback at aka.ms/apimwish.

    do let me know incase of further queries, I would be happy to assist you.

    1 person found this answer helpful.

Your answer

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