How can i replace/escape the single quote in the name
cai.o'dowd as its causing errors string is
Currently i’m doing the below and filtering based on userprinciplename
ObjectuserId = (Get-AzureADUser -Filter "UserPrincipalName eq '$($User.LoginName.replace('i:0#.f|membership|',''))'").ObjectId
Any ideas how i can do this in PowerShell? I would also like to check if the field is null before processing it.