Jump to content

Microsoft Cloud Products - Repeated Powershell Authentication


Recommended Posts

Posted (edited)

Hello,

 

We use a number of different Powershell script to perform tasks for MS cloud products. A basic example is offboarding. The script sets a forwarding address in Exchange Online and then removes licenses from the user account. It also modifies something in Azure AD.

 

It is requiring us to authenticate 3 times. Once for Connect-MsolService, the second for Connect-ExchangeOnline and a third for Connect-AzureAD.

 

We also have some more advance ones that also make modifications to Dynamics and Business Central.

 

Is there a way to authenticate once please?

 

We used to use get-credential but it doesn't work with MFA. I don't think it works at all anymore?

 

I know there is "Connect-ExchangeOnline -UserPrincipalName [email protected]" for Exchange Online. I could figure out how to populate the UserPrincipalName automatically however this option isn't available on on modules.

 

I was wondering if anyone has any suggestions please?

 

Thanks

Edited by FN-GM
Posted

Thanks - what happens if someone (a service desk guy) takes a copy of the certificate? We wouldn't know. At least at the moment when they leave we will disable their accounts and cut off access.

 

Also if we used this method would the audit log show who had executed the commands / script?

 

Thanks

Posted
We run all ours from a specific site and then exclude that site from MFA using conditional access.

 

It is something I have considered. However in the next 12 months or so we are to be completely cloud. There will be no VPN so will create issues when working from home when that time comes.

Posted
I like using graph API where possible which means you can be very granular with the rights you give it and using a service principal means no MFA headache. It's a bit lacking in the Exchange side of things.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...