Call De-identification Service with python SDK getting 403 Forbidden
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:
YAMLCopy
Error:
PythonCopy
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'}
It was recommended in this previous question to
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
Unfortunately this did not work and was able to confirm that both api_versions '2024-02-28-preview' and '2024-09-20' give the error:
service responds error: (ApiVersionUnsupported) Unsupported api-version '2024-09-20'. The supported api-versions can be view in response header 'api-supported-versions'. Code: ApiVersionUnsupported Message: Unsupported api-version '2024-09-20'. The supported api-versions can be view in response header 'api-supported-versions'.