MS Graph API for the Azure AD PowerShell replacement cmdlets ?

EnterpriseArchitect 4,781 Reputation points
2022-08-01T13:01:57.637+00:00

Hi Everyone,

I wonder what's the equivalent Microsoft Graph for the below function or cmdlet?

Since the Azure AD PowerShell Module is about to be deprecated based on https://learn.microsoft.com/en-us/powershell/module/azuread/?view=azureadps-2.0

Connect-AzureAD -TenantId 2e89c6df-50b5-44ce-a2c2-7f65f1916583  
  
Get-AzureADUser -SearchString 'First.LastName@Domain.com' | Get-AzureADUserMembership | Format-List  
				  
Remove-AzureADGroupMember         -ObjectId f4c2fd92-4b6a-4035-b940-ec58acf3d87f -MemberId e1364883-edc6-4369-92ea-618cd2ed9e6d  
Remove-AzureADDirectoryRoleMember -ObjectId f4c2fd92-4b6a-4035-b940-ec58acf3d87f -MemberId 16997715-54b6-45fd-84e8-e1c58c6dbaf5  
Revoke-AzureADUserAllRefreshToken -ObjectId f4c2fd92-4b6a-4035-b940-ec58acf3d87f  
  
Disconnect-AzureAD  

Any help is greatly appreciated.

Thanks.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,670 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,382 questions
0 comments No comments
{count} votes

2 additional answers

Sort by: Most helpful
  1. ShivaniRai-MSFT 2,726 Reputation points
    2022-08-01T13:18:23.523+00:00

    Hi @EnterpriseArchitect ,

    You can find equivalent Microsoft Graph PowerShell SDK in this documentation.

    Reference docs:
    https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.users/get-mgusermemberof?view=graph-powershell-1.0&preserve-view=true

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.
    0 comments No comments

  2. Limitless Technology 39,376 Reputation points
    2022-08-02T07:36:50.837+00:00

    Hi there,

    Scripts written in Azure AD PowerShell won't automatically work with Microsoft Graph PowerShell. The new cmdlet names have been designed to be easy to learn. Instead of using AzureAD or AzureADMS in cmdlet names, use Mg. For example, the old cmdlet Get-AzureADUser has become Get-MgUser. However, migration is more than just becoming familiar with the new cmdlet names. There are renamed modules, parameters, and other important changes.

    Migrate from Azure AD PowerShell to the Microsoft Graph PowerShell SDK

    https://learn.microsoft.com/en-us/powershell/microsoftgraph/migration-steps?view=graph-powershell-1.0

    Azure AD to Microsoft Graph migration changes in Azure PowerShell

    https://learn.microsoft.com/en-us/powershell/azure/azps-msgraph-migration-changes?view=azps-8.1.0

    -----------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    1 person found this answer helpful.
    0 comments No comments