Hi @sid , please check the following for me and let me know the results:
- Make sure that the App registration (Not just the app) has the correct permissions to access the resources in your subscription and. You can check this by going to the "Access control (IAM)" tab in the subscription and verifying that the App registration has the "Reader" role assigned.
- Check if the App registration has the correct permissions to access the Azure Monitor API. You can do this by going to the "API permissions" tab in the App registration and verifying that the App registration has the "Azure Monitor" API permission.
- Make sure that the access token you are using is valid and has the correct permissions. You can try to regenerate the access token and use the new token to query the getBatch API.
- If you are still facing issues, you can try to create a new service principal and assign the required permissions to it. You can then use the new service principal to query the getBatch API.
Please let me know if this helps.
Best,
James