Powershell 7: using ampersand (&) in string literals
16:44 24 Jan 2022

I'm trying to execute the following command in PowerShell, but I have no idea how to escape the ampersand character which is part of the URL

  az rest `
    --method GET `
    --uri ("https://graph.microsoft.com/v1.0/groups?`$count=true&`$filter=startsWith(displayName,'some+filter+text')&`$select=id,displayName") `
    --headers 'Content-Type=application/json'

As the & character is used to start a new command, it breaks the url and want to execute the remainder.

Is there a way to tell powershell not to do that?

powershell