Getting prompted for MFA when executing a script

Resolved

Getting prompted for MFA when executing a script

avatar

Hello, not sure if this is best for this forum or the Macro/Script one.

I recently set up MFA on my RDM instance (checking off Force 2 Factor at the data source in System Settings>Security). Everything has been working great, however I'm encountering an odd issues. I have a few scripts saved in RDM that use the RDM Powershell, and are executed straight from RDM, an example is below. They are Local Powershell sessions, set to use an embedded script.

When running one of the scripts, after signing into RDM with MFA, users are prompted to enter another MFA code. If I just cancel out of the MFA prompt, the script still executes without issue. Similarly, if I import the RDM Module into a standard PS window with RDM completely closed, the script executes without the need for MFA.

Is there a way to make the script from RDM not prompt for MFA when executing? Or do I need to use different logic in any way? It seems like an unintended side-effect, as I'm able to execute it outside of RDM without issue. I've tried changing the credentials to use 'My Personal Credentials', changing the runAs to run as current session, and testing to see if RunAs Admin worked at all.

Thanks for taking the time to check this out!

forum image
forum image
forum image

forum image
forum image

Export-WSUSList.ps1

All Comments (5)

avatar

Hello,

Can you confirm if simply opening the powershell console prompt the MFA for you and not just by running the script from an entry?

I believe this happens automatically when powershell is launched and is trying to connect to the datasource before running your script.
I just wouldn't imagine it doing the same thing from an entry running a command that doesn't has anything to do with the RDM datasource.
A small overlook from us if that's the case.

To open the powershell screen with RDM, simply go from the top Ribbon in Tools > then click on PowerShell button.

Regards,

forum image

Alexandre Roy

avatar

Hello Alexandre,

Yes, when launching just the RDM Powershell prompt, I get the MFA prompt.

Thanks!

avatar

Thank you Oxy,

I will submit a ticket to the engineering team to take a look at this :).

Alexandre Roy

avatar
Thank you Oxy,

I will submit a ticket to the engineering team to take a look at this :).


Great, thanks so much!

avatar

Hi Oxyahna,

You are getting the prompt because the RDM cmdlet is being loaded and attempting to login to the datasource automatically. If your script doesn't have any requirement for the RDM cmdlet, uncheck the "Load RDM Cmdlet" in the properties from the screenshot you sent (it's near the bottom right.) That should stop the MFA prompts from coming in.

-Paul