I recommend checking the authentication logs to get more details. https://learn.microsoft.com/en-us/samples/azure-samples/dsregtool/dsregtool/
The error message can occur for these reasons:
- If the subscription is not attached to the relevant tenant
- If you have registered the application in one tenant but are trying to obtain the auth token from a different one, you may receive this error. If this is the case, I would recommend making sure that you are setting up the correct Entra ID (Azure AD) Instance URLs since we have both the public Azure instance and non-public Azure instance. Endpoints for the cloud instances are listed here:
- If the account you are using to sign in is a domain account that does not exist in Entra (AAD)
- If you are not using the latest version of Microsoft.IdentityModel.Clients.ActiveDirectory.
If you have already checked these variables but are still facing this issue, feel free to send me an email at AzCommunity@microsoft.com ("Attn: Marilee Turscak") and include your subscription ID and a link to this thread, and I will open a one-time free support case to have your issue investigated.