Unable to add owners into AAD app register using Az module powershell script Using Below Script to add users on app.
$appName = "Sampleapp"
$ownerEmail = "[email protected]"
$app = Get-AzADApplication -DisplayName $appName
if ($app) {
$owner = Get-AzADUser -UserPrincipalName $ownerEmail
if ($owner) {
Add-AzADAppOwner -ApplicationId $app.ApplicationId -OwnerObjectId $owner.Id
Write-Host "Owner added successfully."
} else {
Write-Host "Owner with email $ownerEmail not found."
}
} else {
Write-Host "Application with name $appName not found."
}
Getting below error ** The term 'Add-AzADAppOwner' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was | included, verify that the path is correct and try again. **
Unable to find the AZ command to add individual users in app register

Initially I got the same error as below:
Alternatively, you can make use of either AzureAD or MicrosoftGraph or Az CLI module to add owners to the group.
Owner added successfully to the Microsoft Entra application:
Reference:
Get Azure AD Application Owner (Get-AzADApplicationOwner) · Issue #1339 · MicrosoftDocs/feedback · GitHub