locked
Set-MsolServicePrincipal--Unable to complete this action. Try again later RRS feed

  • Question

  • when I try to execute the following command, I am getting "Unable to complete this action. Try again later" exception.

    "Set-MsolServicePrincipal -ObjectId $sp.objectid -Addresses $replyUrl"

    Here is my code: powershell commands with c#.net code

    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");

     foreach (string strcmd in cmdlist)
                        {
                            pipeLine = myRunSpace.CreatePipeline();
                            pipeLine.Commands.AddScript(strcmd);


                            Collection<PSObject> commandResults = pipeLine.Invoke();

                            var error = pipeLine.Error.ReadToEnd();
                            if (error.Count > 0)
                            {
                                result += "Error in setting reply url in ServicePrincipal" + ", ";
                            }
                            pipeLine.Dispose();
                        }


    • Edited by testbuilds123 Thursday, March 3, 2016 5:41 AM
    • Moved by jrv Tuesday, March 7, 2017 5:53 PM Not a scripting question
    Wednesday, March 2, 2016 2:26 PM

Answers

  • It is not PowerShell code.  PowerShell cannot use non-PowerShell syntaxes.

    \_(ツ)_/

    • Proposed as answer by Elaine Jing Friday, March 4, 2016 8:07 AM
    • Marked as answer by Elaine Jing Friday, March 25, 2016 2:34 AM
    Wednesday, March 2, 2016 3:04 PM

All replies

  • It is not PowerShell code.  PowerShell cannot use non-PowerShell syntaxes.

    \_(ツ)_/

    • Proposed as answer by Elaine Jing Friday, March 4, 2016 8:07 AM
    • Marked as answer by Elaine Jing Friday, March 25, 2016 2:34 AM
    Wednesday, March 2, 2016 3:04 PM
  • Hi,

    Actually the code is written in c#,so the coding look like this.

    The same  command "Set-MsolServicePrincipal -ObjectId $sp.objectid -Addresses $replyUrl" if we run it in command mode then also it is giving the same error "unable to complete this action Try again later." 


    srinivas

    Friday, March 11, 2016 12:28 PM
  • set-MsolServicePrincipal -ObjectId 4444444-d9e3-4444-4444-272e4afe4444 -DisplayName "zzz_automation"
    set-MsolServicePrincipal : Unable to complete this action. Try again later.
    At line:1 char:1
    + set-MsolServicePrincipal -ObjectId 4444444-d9e3-4444-4444-272e4afe4444 ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OperationStopped: (:) [Set-MsolServicePrincipal], MicrosoftOnlineException
        + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InternalServiceException,Microsoft.Online.Administration.Automation.SetServicePrincipal

    William Lee

    Tuesday, March 7, 2017 4:45 PM
  • set-MsolServicePrincipal -ObjectId 4444444-d9e3-4444-4444-272e4afe4444 -DisplayName "zzz_automation"
    set-MsolServicePrincipal : Unable to complete this action. Try again later.
    At line:1 char:1
    + set-MsolServicePrincipal -ObjectId 4444444-d9e3-4444-4444-272e4afe4444 ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OperationStopped: (:) [Set-MsolServicePrincipal], MicrosoftOnlineException
        + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InternalServiceException,Microsoft.Online.Administration.Automation.SetServicePrincipal

    William Lee

    If you have a question please start your own topic and give complete details of what you are trying to do.


    \_(ツ)_/

    Tuesday, March 7, 2017 5:50 PM