This guide explains how to use the Update-MgApplication cmdlet in Microsoft Graph PowerShell to modify Azure AD application properties. Learn how to update settings such as display name, and API permissions with practical examples.
In the Microsoft 365 environment, managing applications through automation is crucial for efficiency and scalability. The Update-MgApplication cmdlet in Graph PowerShell is designed to update properties of existing applications in your Azure AD. This guide covers prerequisites, cmdlet syntax, usage examples, cmdlet tips, possible errors and solutions, and use cases of the cmdlet.
Before using the Update-MgApplication cmdlet, ensure the following prerequisites are met:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Application.ReadWrite.All"
Update-MgApplication -ApplicationId <String> [-AddKey <IMicrosoftGraphPasswordCredential>] [-DisplayName <String>] [-AppRoles <IMicrosoftGraphAppRole[]>] [-GroupMembershipClaims <String>] [-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>] [<CommonParameters>]
$applicationId = "your-application-id"
$updatedDisplayName = "New Application Name"
Update-MgApplication -ApplicationId $applicationId -DisplayName $updatedDisplayName
$applicationId = "your-application-id"
$appRole = @{
Id = (New-Guid).Guid
AllowedMemberTypes = @("User")
DisplayName = "New Role"
IsEnabled = $true
Description = "Description of the new role"
Value = "new.role"
}
Update-MgApplication -ApplicationId $applicationId -AppRoles @($appRole)
$applicationId = "your-application-id"
$resourceAccess = @{
ResourceAppId = "00000003-0000-0000-c000-000000000000"
ResourceAccess = @(
@{
Id = "57739978-127b-4163-a178-8f5bb15a0ac3"
Type = "Scope"
}
)
}
Update-MgApplication -ApplicationId $applicationId -RequiredResourceAccess @($resourceAccess)
Get-MgApplication -ApplicationId $applicationId
$jsonString = '{"ResourceAppId":"00000003-0000-0000-c000-000000000000","ResourceAccess":[{"Id":"57739978-127b-4163-a178-8f5bb15a0ac3","Type":"Scope"}]}'
$requiredResourceAccess = $jsonString | ConvertFrom-Json
Update-MgApplication -ApplicationId $applicationId -RequiredResourceAccess @($requiredResourceAccess)
Solution: Ensure your account has the Application.ReadWrite.All permission and that you've consented to this permission scope.
Solution: Verify the application ID and ensure it exists in your directory.
Get-MgApplication -ApplicationId $applicationId
Solution: Double-check the property names and their values. Some properties may be read-only or have specific formats.
1. What is Update-MgApplication used for?
Update-MgApplication is a Microsoft Graph PowerShell cmdlet used to update properties of Azure AD applications, such as their display name, redirect URIs, or permissions.
2. What permissions are required to use Update-MgApplication?
You need the Application.ReadWrite.All permission in Microsoft Graph PowerShell. Ensure these permissions are granted in Azure AD.
The Update-MgApplication cmdlet is a powerful tool for managing and updating applications in Azure AD. By understanding its prerequisites, syntax, usage examples, and tips, you can effectively automate application management tasks. Keep in mind possible errors and their solutions to troubleshoot issues efficiently. Utilizing this cmdlet enhances your capability to maintain a secure and well-managed application environment.
For further details, read the official Microsoft Documentation for the cmdlet.
© m365corner.com. All Rights Reserved. Design by HTML Codex