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

AMaDAC 81 Reputation points
2021-03-11T18:40:04.92+00:00

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.

Microsoft Teams | Development
Microsoft Teams | Development
Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Windows for business | Windows Server | User experience | PowerShell
Microsoft Teams | Microsoft Teams for business | Other
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Rich Matheisen 48,026 Reputation points
    2021-03-11T20:42:46.473+00:00

  2. JimmyYang-MSFT 58,741 Reputation points Moderator
    2021-03-12T07:05:46.163+00:00

    Hi @Rich Matheisen ,

    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.


  3. Kartheek Raparthy 1 Reputation point
    2021-03-12T12:37:43.753+00:00

    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.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.