diff --git a/examples/Get OAuth2 access token from AAD using MI and forward it to the backend.policy.xml b/examples/Get OAuth2 access token from AAD using MI and forward it to the backend.policy.xml new file mode 100644 index 0000000..fbdec52 --- /dev/null +++ b/examples/Get OAuth2 access token from AAD using MI and forward it to the backend.policy.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @($"{(string)context.Variables["authoization-Server"]}/{(string)context.Variables["tenantId"]}/oauth2/v2.0/token") + POST + + application/x-www-form-urlencoded + + @{ + return $"client_id={(string)context.Variables["clientId"]}&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&client_assertion={(string)context.Variables["client_assertion"]}&grant_type=client_credentials&scope={(string)context.Variables["resource"]}/.default"; + } + + (); + return responseBody["access_token"].ToString(); + }" /> + + + @{ + return $"Bearer {(String)context.Variables["token"]}"; + } + + + + + + + + + + + + + +