How can we improve Azure Automation service?

Enable Implicit Remoting

I don't seem to be able to use implicit remoting to manage things like Exchange Online or the Office 365 Compliance Center, which leverages Exchange as well.

This is a hurdle for me as I can't migrate some of our important jobs to Azure Automation. Is it possible to enable implicit remoting in the PowerShell environment?

Thanks!

18 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Matt McNabb shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    under review  ·  Beth Cooper responded  · 

    Thanks for this feedback. We will take a look.

    Also, do you have an example of a command that you are trying to use right now? I’ve heard of other customers managing Exchange & O365 with Automation, so there might be a different way to perform the task you are trying to do.

    11 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Bhargav commented  ·   ·  Flag as inappropriate

        Hello, i need a help here. is there any way to connect with on premises Active Directory using azure automation Run book? i have two environments on-prem and online. i have to work with both environments to make changes in mailbox level by using azure automation runbook. please let me know how to connect on prem AD exchange/AD with runbook.

      • Anonymous commented  ·   ·  Flag as inappropriate

        Please can we get an update on this? It's been quite painful struggling with the issues this causes and eventually coming to this page to find the suggested workarounds.. Thanks :-)

      • Anonymous commented  ·   ·  Flag as inappropriate

        Please provide an update on this. It states - 'Under Review' on May 27 2016.
        This is needed for Admins that want to run scripts in the cloud and remove on-prem presence.

      • Lorraine commented  ·   ·  Flag as inappropriate

        I can confirm that Rune Myrhaug's solution worked for me in Azure automation runbooks.

      • Tao Yang commented  ·   ·  Flag as inappropriate

        I can confirm the workaround Rune Myrhaug posted on June 20 worked in Azure workers.

      • AdminBeth Cooper (Admin, Microsoft Azure) commented  ·   ·  Flag as inappropriate

        Thanks for following up Rune! Are you running that in hybrid or in an Azure worker?

        Matt, were you running Invoke-Command or Import-Session on the hybrid runbook worker? Can you try using Invoke-Command or New-PSSession instead of Import-Session and see if that fixes things? If it does not and you can still run things for a while on hybrid, then they start failing, please email me directly at elcooper@microsoft. I would need your subscription ID, account name, the name of the hybrid worker and then a job ID of a failed job to investigate what went wrong.

      • Rune Myrhaug commented  ·   ·  Flag as inappropriate

        This works :)

        $ExchangeOnlineSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection -Name $ConnectionName
        Import-Module (Import-PSSession -Session $ExchangeOnlineSession -AllowClobber -DisableNameChecking) -Global

      • Matt McNabb commented  ·   ·  Flag as inappropriate

        Beth: I have tried both workarounds with limited success. After running the script in Azure using Import-Session I tried using Invoke-Command and had no luck. Next I tried running the script on a hybrid worker (using Import-Session) and had success.

        Then I scheduled it to continue running on a hybrid worker and after 5 days it stopped working and began returning the same exception as before - "The job action 'Activate' cannot be run, because the process stopped unexpectedly. The job action was attempted 3 times."

        It just seems really inconsistent at this point and I can't find any rhyme or reason. I believe there is some issue with the execution engine and implicit remoting but can't really say what.

        Sorry, I realize that this is not a support forum but I thought I should elucidate the issue a bit.

      • Matt McNabb commented  ·   ·  Flag as inappropriate

        Beth,

        Interesting - I hadn't thought about just using Invoke-Command. I'll try that and see if it works.

        Does this serve as a confirmation that implicit remoting is not possible in Azure Automation?

        Thanks!

      • AdminBeth Cooper (Admin, Microsoft Azure) commented  ·   ·  Flag as inappropriate

        Thanks Matt. You can use the workaround with a hybrid runbook worker as the article you shared suggests for Exchange management.

        If you don't want to use hybrid though, you could use Invoke-Command which does work in Automation. So for example, you could do something like the following in a script which does look like it works:

        $UserCredential = Get-AutomationPSCredential -Name 'MyCredential'

        $Session = New-PSSession `
        -ConfigurationName Microsoft.Exchange `
        -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
        -Credential $UserCredential `
        -Authentication Basic `
        -AllowRedirection

        $Output = Invoke-Command -Session $Session -ScriptBlock {
        Get-Mailbox
        }

        Write-Output $Output

      • Matt McNabb commented  ·   ·  Flag as inappropriate

        I'm just using the commands detailed here
        https://technet.microsoft.com/en-us/library/jj984289%28v=exchg.160%29.aspx?f=255&MSPPError=-2147217396

        to connect to Exchange Online, and there's a similar command to connect to the Compliance Center, which also uses an Exchange implicit remoting session.

        It seems to just spin on the Import-PSSession command and the verbose log message states:

        "Importing function 'Update-roleGroupMember'..."

        this repeats over and over as each remote command is received. Eventually something happens and the job is suspended with this exception:

        "The job action 'Activate' cannot be run, because the process stopped unexpectedly. The job action was attempted 3 times"

        I found this blog:

        https://www.itunity.com/article/managing-office-365-azure-automation-3331

        Where it states that Automation can't deal with importing commands from a remote session, but so far I haven't found this detailed anywhere in the Automation documents.

      Feedback and Knowledge Base