List<string> cmdlist = new List<string>(); cmdlist.Add("$sp = Get-MsolServicePrincipal -AppPrincipalId \"" + AppPrincipalId + "\""); cmdlist.Add("$replyHost = \"" + strReplyURL + "\""); cmdlist.Add("$replyUrl = New-MsolServicePrincipalAddresses –Address $replyHost"); cmdlist.Add("Set-MsolServicePrincipal -ObjectId $sp.objectid -Addresses $replyUrl"); //getting exception here</string></string>