Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-RestMethod : The remote server returned an error: (403) Forbidden. #30

Open
cyberseckl opened this issue Sep 7, 2023 · 2 comments

Comments

@cyberseckl
Copy link

I get the following error when I try to run New-DCConditionalAccessPolicyDesignReport
I used a User with Global Admin rights, but it still gives me an Error 403. Is this a permission issue? What should I change?

Invoke-RestMethod : The remote server returned an error: (403) Forbidden.
At C:\Program Files\WindowsPowerShell\Modules\DCToolbox\2.0.2\DCToolbox.psm1:1031 char:29

  • ... ryRequest = Invoke-RestMethod -Headers $HeaderParams -Uri $GraphUri - ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExcept
      ion
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
@c3rberus
Copy link

c3rberus commented Sep 14, 2023

I am running into the same issue using New-DCConditionalAccessPolicyDesignReport, DCToolbox 2.0.2 from PowerShellGallery.

If I try using PoSh 7.3.2 I get a different error..

VERBOSE: Generating Conditional Access policy design report...
Invoke-RestMethod: {"error":{"code":"ResourceNotFound","message":"NamedLocation with id xxxxx does not exist in the
directory.","innerError":{"date":"2023-09-14T22:25:51","request-id":"xxxxx","client-request-id":"xxxxx"}}}

@c3rberus
Copy link

Looks like one of my CA policies had a stale location exclude, once I updated the CA policy and re-run DCConditionalAccessPolicyDesignReport it worked without issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants