I've got a script for interacting with Microsoft GraphAPI. In the script I define a variable for the URL to use, e.g.
$UriGet = "https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies?`$filter=startswith(displayName,`'$Identifier`')"
The function then reads from a CSV, and processes each line in the CSV against the $UriGet URI. The function is called like:
Invoke-GraphApi -UriGet $UriGet
However, inside the function, the actual "$Identifier" variable is substituted with nothing, e.g. its like the $UriGet has been passed with the pre-function variable evaluated, at which time its $null.
e.g., within the "Invoke-GraphApi function, write-host $UriGet provides
URIGet value: "https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies?$filter=startswith(displayName,'')"
So the question is, how do I pass the full string into the function without variables been evaluated?
Edit - here is the Param block for the function
Param (
[parameter(Mandatory=$true)]
[Hashtable]$MsGraphAuthenticationHeader,
[parameter(Mandatory=$true)]
[String]$UriGet,
[parameter(Mandatory=$true)]
[String]$UriPatch,
[parameter(Mandatory=$true)]
[String]$UriPost,
[parameter(Mandatory=$true)]
[String]$Identifier,
[parameter(Mandatory=$true)]
[String]$RequestBody
)
Invoke-GraphApifunction definition (or, at the very least, itsparam()block)