Forum Discussion

vrush96's avatar
vrush96
Copper Contributor
Aug 29, 2024
Solved

Facing error when running a ps script using mggraph

Hi Community,   I am facing issue in fetching lastsignindate from azure ad using mggraph it returns error of 404 not found whereas user is present in azure ad.   The script i am sharing has some ...
  • LainRobertson's avatar
    Aug 29, 2024

    vrush96 

     

    Hi.

     

    Your second and third Invoke-RestMethod URIs don't look properly formatted to me, going off what you've pasted in this thread.

     

    Because the strings are using double-quotes, PowerShell will parse breakout characters like $ and ? instead of interpreting them literally.

     

    I haven't bothered running a real test as there's no need. In the examples below, the only thing we're interested in is the parsed URI in yellow. Here, you can see that based on your code, you're not going to get the URI you think you're getting (first example) unless you remember to escape the special characters (second example).

     

     

     

    Cheers,

    Lain

Resources