Connecting to Office 365 Powershell through RDP Manager

Connecting to Office 365 Powershell through RDP Manager

avatar

Hi All,

I've googled the living daylights out of this one and this is probably a mixture of my lacking knowledge in scripting with a hint of not really getting a full picture of what I need to do.

I'm looking to go entirely passwordless here, to do this I need to be able to setup RDP Manager so the team can connect to a clients Tenant via powershell but without them having to enter the password.

I'm aware of the scripts I need to run, what I don't understand is how I need to set this up so it will pass all the information through by itself.

Any help is much appreciated.

All Comments (5)

avatar

Hello,

You can use the $USERNAME$ and the $PASSWORD$ variables in your RDM PowerShell entry to pass the credential information from RDM to O365. Please note that for the password, you will need to allow the usage of that variable in the entry and in the linked credential (if you use one). For more information, you can refer to https://kb.devolutions.net/unable_use_$password$_variable.html

For a full list, you can click on the "Variables" button in the bottom left corner of any entry:

forum image

Best regards,

Richard Boisvert

avatar

Hi Richard,

Thanks, this is the script I'm running: -

$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $SessionConnect-MsolService -Credential $LiveCred

I then get the pop out window asking for credentials, where in this would I put the variables so they are passed through automatically?

avatar

Hello,

Instead of using the Get-Credential, you would place the credential in RDM, either directely (custom) or in a linked credential.

The first 2 line of you script would change to convert the password to a securestring and create a credential entry:

$password = ConvertTo-SecureString $PASSWORD$ -AsPlainText -Force 
$Cred = New-Object System.Management.Automation.PSCredential ($USERNAME$, $password)

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $SessionConnect-MsolService -Credential $Cred



forum image

Best regards,

Richard Boisvert

avatar

Hi Richard,

Thanks, I've tried both ways as mentioned above but it seems to error.

forum image

avatar

Hello,

If you simply display the $USERNAME$ and the $PASSWORD$ variable in the script, do they both return the correct information?

If so, it would indicate the cmdlets you are using to connect to the O365 are the culprit.

Best regards,

Richard Boisvert