Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
param([string]$UserPrincipalName)

Connect_Graph_Api      # If your name of the connect script is different, change this to reflect the changes. Replace spaces with underscores

Select-MgProfile -Name beta

Import-Module Microsoft.Graph.Identity.SignIns

Get-MgUserAuthenticationEmailMethod -UserId $UserPrincipalName | % {
    try {
        Write-Output "Removing email $($_.EmailAddress)"
        Remove-MgUserAuthenticationEmailMethod -UserId $UserPrincipalName -EmailAuthenticationMethodId $_.Id
    } catch {
        Write-Error "Error removing email. $_"
    }
}


Get-MgUserAuthenticationPhoneMethod -UserId $UserPrincipalName | % {
    try {
        Write-Output "Removing phone $($_.PhoneNumber)"
        Remove-MgUserAuthenticationPhoneMethod -UserId $UserPrincipalName -PhoneAuthenticationMethodId $_.Id
    } catch {
        Write-Error "Error removing phone. $_"
    }
}

Video

...

Video walk through of the process above:

...