We sincerely apologize for the delay in response and appreciate your patience.
I see. It looks like the masking is not working as expected and is replacing the actual values with asterisks instead of hiding them.
In that case, you can try using a custom policy to mask the values in the response. Here's an example policy that you can use:
<outbound>
<base />
<choose>
<when condition="@(context.Response.StatusCode == 200)">
<set-status code="200" reason="ok" />
<set-body template="liquid" >
{
"username": "{{context.Variables["vault_response"]["data"]["data"]["username"] | mask}}",
"password": "{{context.Variables["vault_response"]["data"]["data"]["password"] | mask}}"
}
</set-body>
</when>
<otherwise>
<set-status code="@(context.Response.StatusCode)" reason="Bad Request" />
<set-body>@(((IResponse)context.Variables["response"]).Body.As<JObject>(preserveContent: true).ToString())</set-body>
</otherwise>
</choose>
</outbound>
This policy uses the Liquid template language to mask the values of the "username" and "password" fields in the response. The | mask filter will replace the actual values with asterisks.
Please note that this policy will only mask the values in the response and not in the pipeline script. You will still need to use the variable group feature to store the secrets and reference them in your pipeline script as I mentioned earlier.
I hope this helps! Let me know if you have any further questions or need additional assistance.