1

This is a follow up to the following question: How to prevent Ocp-Apim-Trace: true and ocp-apim-trace-location in production?

My API consumers must have a subscription key to be able to use my API. However, I do not want them to see the detail traces provided in ocp-apim-trace-location. The detail trace provides them visibility to my internal service URLs and details that can be a potential security risk.

How to eliminate tracing (prevent Ocp-Apim-Trace) when the call includes a subscription key?

Allan Xu
  • 7,998
  • 11
  • 51
  • 122

1 Answers1

3

There is no way to disable tracing funtionality, not sending this header will disable tracing collection for one request only. But do know, that only admin users are capable of collecting traces, if this header is supplied along with subscription key that does not belong to admin account (or no subscription key at all) no traces will be collected. The idea here is that traces may expose information service owner may not be willing to share with developers.

Actually, you could design APIs belong to an open product to be callable anonymously.

Create a new product and uncheck Require subscription in its settings. Any API added to such product will be callable without a key anonymously.

So that you could let your consumer anoymously call your API without subscription key and then eliminate tracing.

For more details, you could refer to this article.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30
  • Thank you for help. I am an admin in my APIM. Is there any way I can produce a non-admin subscription key, so that I can test the senario you mentioned: if this header is supplied along with subscription key that does not belong to admin account no traces will be collected – Allan Xu Nov 15 '18 at 04:49
  • Create a new user, subscribe him to a product, and use his subscription key to make a call. You can do that from Azure portal. – Vitaliy Kurokhtin Dec 03 '18 at 18:53
  • thanks Vitalyi, this resolved my issue. Also, remember to disable tracing when creating new product and new user subscription with Auth Type: Basic rights in API Management portal – Joe Gurria Celimendiz Apr 20 '22 at 15:07