Call De-identification Service with python SDK getting 403 Forbidden

ping940706 0 Reputation points
2024-11-07T23:02:48.1966667+00:00

I am using python SDK to call Azure De-identification Service, but keep getting 403 forbidden response. I am sure that my Client ID, Tenant ID and Client Secret is correct (tried them on other services) and my de-identification url (endpoint) is copied directly from the resource overview page. I also checked the IAM of my de-identification resource, where no problem was found.

The SDK I am using is https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/healthdataaiservices/azure-health-deidentification

While debugging, I found one possible root cause. which is the api-version,

In the Azure portal under the De-identification Service resource overview, the available API versions are: 2024-09-20 and 2024-02-28-preview

However, in the Python SDK, the DeidentificationClient class defaults to using the API version 2024-07-12-preview, which is not available in the portal. I tried to override the default api-version but no successes, as it only accepts 2024-07-12-preview. (see the following error:

Error: 400
{"error":{"code":"ApiVersionUnsupported","message":"Unsupported api-version '2024-09-20'. The supported api-versions can be view in response header 'api-supported-versions'."}}
response.headers{'Date': 'Thu, 07 Nov 2024 22:33:18 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache,no-store', 'Expires': '-1', 'Pragma': 'no-cache', 'x-ms-error-code': 'ApiVersionUnsupported', 'api-supported-versions': '2024-07-12-preview', 'api-deprecated-versions': '1, 2024-01-16-preview', 'X-Content-Type-Options': 'nosniff', 'x-ms-correlation-id': '4e366b90-165a-406f-a006-b721b50572fd', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'}

)

Azure Health Data Services
Azure Health Data Services
An Azure offering that provides a suite of purpose-built technologies for protected health information in the cloud.
172 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shireesha Eeraboina (Quadrant Resource LLC) 570 Reputation points Microsoft Vendor
    2024-11-15T17:44:04.5366667+00:00

    Hi @ping940706 ,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    It seems that the issue you're encountering with the Azure De-identification Service API using the Python SDK is related to the default API version (2024-07-12-preview), which is not available in the portal. To resolve this, you should explicitly specify a supported API version when initializing the Deidentification Client. A version like 2024-09-20 or 2024-02-28-preview should work since these are available in the Azure portal. In your code, you can provide the correct API version by adding the Api version parameter when creating the Deidentification Client instance. Additionally, ensure that your credentials (tenant ID, client ID, and client secret) are correctly set up using the ClientSecretCredential class from the azure. Identity library, and that your endpoint is accurate. By making these adjustments, you should be able to interact with the De-identification Service successfully and avoid the issue caused by the unavailable API version.

    I hope that this response will address your query and helped you overcome your challenges.

    Thankyou.


Your answer

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