I have created some Azure function apps and imported them to APIM, where they work fine. But I have a problem with some APIs that use certificate authentication. When I access the APIM Developer Portal for the first time and try to test an API that does not need a certificate, the browser still asks me to select a certificate.
is this is expected scenario?
Inbound policy of API that have certificate authentication:
<inbound>
<base />
<choose>
<when condition="@(context.Request.Certificate == null || !context.Deployment.Certificates.Any(c => c.Value.Thumbprint == context.Request.Certificate.Thumbprint))">
<return-response>
<set-status code="403" reason="Invalid client certificate" />
</return-response>
</when>
<otherwise />
</choose>
<authentication-certificate certificate-id="DevCert" />
<set-backend-service id="apim-generated-policy" backend-id="sample-func" />
</inbound>
Inbound policy of API that DOES NOT HAVE certificate authentication:
<inbound>
<base />
<set-backend-service id="apim-generated-policy" backend-id="sample-func" />
</inbound>
No, this is not the expected case. You shouldn't get the option to select the certificate for the API which is not having
authentication-certificatepolicy in it unless you have added the policy in global level or in product level and have attached that product to the API.I have imported an Azure function to the APIM instance and it is having two operations(GET, POST) in it.
Policy of GET operation looks like below-
Policy of POST operation looks like below-
Then I published the developer portal and trying to access these operations.
GET Operation-
POST Operation-
Not being asked to select the certificate even if I am trying to access the Post operation prior.
Verify your policies and publish the developer portal after making the changes.