I'm trying to create a script to update Azure AD Privileged Identity Management which requires an object in the format below.
I want to be able to pass variables to the object, e.g. '{"required":$MFA}', where $MFA comes from a variable. I've tried the script block below but it doesn't recognize $MFA as a variable. Any ideas?
# Set MFA Variable
$MFA = "True"
# Create object
$myObject = [PSCustomObject]@{
RuleIdentifer = "JustificationRule"
Setting = '{"required":$MFA}'
}
#Output object
write-host $myObject
The output just writes the $MFA text. It doesn't substitute $MFA for "True"
@{RuleIdentifer=JustificationRule; Setting={"required":$MFA}}