@Jil Kachhia - Welcome to Microsoft Q&A and thanks for reaching out to us.
The "Access to the resource is forbidden" error typically indicates that the access token you are using does not have the necessary permissions to access the Azure Policy Compliance data. Please check below for some troubleshooting steps that can help resolve the issue.
- Ensure that the Azure AD application you registered has the necessary permissions to access the Azure Policy Compliance data. Specifically, the application needs the "Reader" role on the subscription or resource group that contains the Azure Policy Compliance data.
- Ensure that the API request you are making is correctly formatted and includes the necessary headers and parameters. Specifically, the request needs to include the access token in the "Authorization" header and the correct API endpoint URL.
- Ensure that the Azure Policy Compliance data you are trying to access is correctly configured and accessible by REST API.
Hope this helps. and please feel free to reach out if you have any further questions.
Please don't forget to "Accept as Answer" and click "Yes" if the above response is helpful, so it can be beneficial to the community.