I am running a command to add machines to the domain and it all works ok.
I now want to take the values in $string1 from parameters values, is there a way of doing this?
$rg = "resourcegroup"
$machines = Get-AzureRmVM -ResourceGroupName $rg
$string1 ='{
  "Name" : "domain.local",
  "User": "domain.local\\domainadmin",
  "Restart" : "true",
  "Options" : "3",
}'
$string2 = '{"Password" : "@@@@@@@@@@@@@B"}'
$machines | ForEach { Set-AzureRmVMExtension -ResourceGroupName $rg
  -ExtensionType "JSONADDomainExtension" -Name "joindomain"
  -Publisher "Microsoft.Compute" -TypeHandlerVersion "1.0" -VMName $_.Name
  -Location "uk west" -SettingString $string1 -ProtectedSettingString $String2 }