An Azure relational database service.
The error you are encountering (401 Unauthorized) indicates that the access token being used is from the wrong issuer. Specifically, it mentions that the token must match the tenant associated with your subscription. Here are some steps you can take to resolve this issue:
- Check Tenant ID: Ensure that you are using the correct tenant ID when requesting the access token. The error message specifies that you should use the authority URL
https://login.windows.net/33e01921-4d64-4f8c-a055-5bdaffd5e33dto obtain the token. - Token Acquisition: When acquiring the token, make sure that the request is made to the correct tenant. This typically involves specifying the tenant ID in your authentication request.
- Subscription Transfer: If you have recently transferred your subscription to a different tenant, it may take some time for the changes to propagate. If this is the case, you might need to wait for up to an hour and try again.
- Verify Resource ID: As you noted, the Azure DB's Resource ID should align with your Tenant ID. Ensure that the resource you are trying to access is indeed associated with the tenant you are using to authenticate.
- Permissions: Ensure that the account you are using has the necessary permissions to access the Azure SQL Database through the private endpoint.
By following these steps, you should be able to resolve the 401 error and successfully connect to your Azure SQL Database through the private endpoint.