Setting StrongAuthenticationUserDetails PhoneNumber for AzureAD via Powershell?

This name really flows.

When we set up computers for use with Azure Active Directory, we would perform the initial setup and configuration. This included first logging in and joining Azure Active Directory. When you log in, you need to choose a verification method. For convenience, we will use our desk phone or mobile phone.

It is time to update this second factor phone number. I know how to manually do this through the Azure AD Web UI, but I'm looking for a script to set this number in PowerShell.

This is how I get the number through PowerShell.

Get-msoluser -UserPrincipalName "email@emailaddress.com" | Select-Object -ExpandProperty StrongAuthenticationUserDetails

This code returns this information:

ExtensionData                     : System.Runtime.Serialization.ExtensionDataObject
AlternativePhoneNumber            :
Email                             :
OldPin                            :
PhoneNumber                       : +1 5554445555
Pin                               :

However, it seems that there is no similar option for setting StrongAuthenticationUserDetails.

, , . StrongAuthentication , .

+4
1

, powershell.

Azure.

, ETA. , , PowerShell.

powershell watir .NET Watin Watin recorder, Internet Explorer. Azure; .

Watin powershell - : https://cmille19.wordpress.com/2009/09/01/internet-explorer-automation-with-watin/

, , ( ):

HTML, . WatIN " " . #, PowerShell:

// Windows
WatiN.Core.IE window = new WatiN.Core.IE();

// Frames
Frame frame_sd_scoreboard = window.Frame(Find.ByName("sd") && Find.ByName("scoreboard"));

// Model
Element __imgBtn0_button = frame_sd_scoreboard.Element(Find.ByName("imgBtn0_button"));

// Code
__imgBtn0_button.Click();
window.Dispose();

, 3 . WatIN , script, 50 .

#Requires -version 2.0
#powershell.exe -STA

[Reflection.Assembly]::LoadFrom( "$ProfileDirLibrariesWatiN.Core.dll" ) | out-null
$ie = new-object WatiN.Core.IE("https://sd.acme.com/CAisd/pdmweb.exe")
$scoreboard  = $ie.frames | foreach {$_.frames } | where {$_.name –eq ‘sd’} |  foreach {$_.frames } | where {$_.name –eq ‘scoreboard’}
$button = $scoreboard.Element("imgBtn0_button")

while ($true)
{
    $button.Click()
    #Sleep for 50 minutes
    [System.Threading.Thread]::Sleep(3000000)
}
+1

Source: https://habr.com/ru/post/1683835/


All Articles