locked
Converting Msol powershell to Azure powershell help RRS feed

  • Question

  • Hi

    Could i get some help converting the following MSOL powershell to az powershell please?

    My backgroup is not in powershell.

    This script add people into a group that have completed the aka mfa details.

    i want to automate this in azure runbook

    Msol powershell :

    $group = get-msolgroup -objectid <IDnumber>
    $users = get-msoluser -All| select userprincipalname,objectid,StrongAuthenticationMethods | where {$_.StrongAuthenticationMethods -ne $null}

    $users | foreach {add-msolgroupmember -groupobjectid $group.objectid -groupmembertype "user" -groupmemberobjectid $_.objectid}

    Az Powershell

    $group = get-AzureADgroup - <groupID>

    and then im stuck.

    thanks 

    Jess



    • Edited by Jess365 Monday, March 18, 2019 11:48 AM
    • Moved by Bill_Stewart Wednesday, September 4, 2019 6:42 PM Off-topic
    Monday, March 18, 2019 11:35 AM

All replies

  • You should ask Azure specific questions in the Azure Scripting and tools forum.

    You can also look up the CmdLets for Azure to learn how they are different.

    https://docs.microsoft.com/en-us/powershell/module/azurerm.resources/get-azurermadgroup?view=azurermps-6.13.0

    Get-AzureRMADGroup -ObjectID <objectID>


    \_(ツ)_/

    Monday, March 18, 2019 1:50 PM
  • Hi Jess,

    Connect-Azure: allows user to manage Active Directory objects only, [where directory is hosted in Azure]. Connect-Msoline: apart from managing Active Directory allows more administrative tasks such as Domain management, configure single sign-on etc.

    The following is for the first 2 lines but for MFA, you need the MSOL.

    Connect-AzureAD

    $group = Get-AzureADGroup -ObjectId <groupID>
    $users = Get-AzureADUser -All:$true | select userprincipalname, objectid, StrongAuthenticationMethods | where {$_.StrongAuthenticationMethods -ne $null}

    Hope this helps

    Justin




    Justin

    Wednesday, September 2, 2020 3:47 PM