question

AMaDAC-0347 avatar image
0 Votes"
AMaDAC-0347 asked Rasithvahith-3996 commented

Creating PowerShell Script for auto login in O365 (MS Teams) using MFA - Admin side

The idea is to create a script to automatically login to MS Teams and whenever or someone changes the settings in meeting policy it will triggered an alert or email and also run the script to revert back the changes.

P.S I'm using MFA and please if know a forum or link it will be a great help.

office-teams-windows-itprowindows-server-powershelloffice-teams-app-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered AMaDAC-0347 commented
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I guess I need to totally by pass the MFA by creating conditional policy in azure.

0 Votes 0 ·

BTW, can you please refer a website or documentation that can lead me to this idea.

"The idea is to create a script to automatically login to MS Teams and whenever or someone changes the settings in meeting policy it will triggered an alert or email and also run the script to revert back the changes."

0 Votes 0 ·
JimmyYang-MSFT avatar image
0 Votes"
JimmyYang-MSFT answered AMaDAC-0347 commented

Hi @RichMatheisen-8856,

Sorry, I did not find such scripts to convert back the settings for Teams admin center.

For Teams client, if you want to login automatically, you should click “yes” to store the password for your account when you see the following page:

77064-9.png


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



9.png (169.4 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AMaDAC-0347

Have you tried to @KartheekRaparthy-6860 's suggestions about this issue? Does it work for you?

0 Votes 0 ·

@AMaDAC-0347

Just checking in to see if above information was helpful. If you have any further updates on this issue, please feel free to post back.

0 Votes 0 ·

This is for the web console access only and not apply to PowerShell.
I guess PowerShell session will last only 12 hours and needs to login again? Please correct me if I'm wrong.

The goal is to maintained the desired settings in MS Teams.

  • the script will be added to Task scheduler that runs every hour to maintain the current settings.

0 Votes 0 ·
KartheekRaparthy-6860 avatar image
0 Votes"
KartheekRaparthy-6860 answered Rasithvahith-3996 commented

Please use below script for auto login to teams.

$username = "<username>"
$passwd = "<password>"
$secpasswd = ConvertTo-SecureString -String $passwd -AsPlainText -Force
$cred = New-Object Management.Automation.PSCredential ($username, $secpasswd)
Connect-MicrosoftTeams -Credential $cred

For meeting policy change alerts you can create Alert in audit logs. This is available in azure security and compliance. you can choose recipient email address.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Is this the same with O365 Security and Compliance?

I have checked that and not able to see the option to send an alert whenever changes the settings in Web console or MS Teams Admin center.

0 Votes 0 ·

Audit data is only visible in the audit log if auditing is turned on.
It can take up to 30 minutes or up to 24 hours after an event occurs for the corresponding audit log record to be returned in the results of an audit log search.

please go through below links to enable audit log for teams.
link1
link2


0 Votes 0 ·
JimmyYang-MSFT avatar image JimmyYang-MSFT KartheekRaparthy-6860 ·

@AMaDAC-0347

Just checking in to see if above information was helpful. If you have any further updates on this issue, please feel free to post back.

0 Votes 0 ·

Hi,
I tried above mentioned script with our credentials with domain but i am getting below mentioned error while running.

Connect-MicrosoftTeams : One or more errors occurred.: AADSTS50076: Due to a configuration change made by your administrator, or because you
moved to a new location, you must use multi-factor authentication to access '00000002-0000-0000-c000-000000000000'.

I need to check who are all having Teams app access outside the organizations against the policy. Please kindly help us to achieve this.

Thanking you.

0 Votes 0 ·