Azure / Azure/azure-powershell
Enable Cmdlet to manage AzADApplicationOwner via New-AzADServicePrincipal
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
When moving from AzureAD to Az.Resources module I had to comment out the following code and it currently has no replacement.
I am able to create a new service principal `new-azadserviceprincipal` however I am unable to add owners, other than the person who originally creates the SP and Managed Application.
```powershell
# #region Add extra owners on the Service principal
# Connect-AzureAD -TenantId $Tenant
# foreach ($admin in $SPAdmins)
# {
# $adminID = Get-AzADUser -UserPrincipalName $admin
# if ($adminID.Id)
# {
# try
# {
# Add-AzureADServicePrincipalOwner -ObjectId $sp.id -RefObjectId $adminID.Id -ErrorAction Stop -InformationAction Continue
# Add-AzureADApplicationOwner -ObjectId $appID.ObjectId -RefObjectId $adminid.Id -ErrorAction SilentlyContinue -InformationAction Continue
# }
# catch
# {
# Write-Warning $_.Exception.Message
# }
# }
# else
# {
# Write-Warning "AzADUser [$admin] not found!!!"
# }
# }
# #endregion
```
The Cmdlets are:
- Add-AzureADServicePrincipalOwner
- Add-AzureADApplicationOwner
Contributor guide
Assessment
This issue has not been assessed yet.