Get-AzureRmADApplication and Get-AzureRmADServicePrincipal need way to query by owner/creator
According to https://azure.microsoft.com/en-us/documentation/articles/active-directory-service-limits-restrictions/ , "A non-admin user can create no more than 250 objects."
Today I experienced this limit, with the error message:
New-AzureRmADApplication : The directory object quota limit for the Principal has been exceeded. Please ask your administrator to increase the quota limit or delete objects to reduce the used quota.
The issue is that there is no way to get all Applications or Service Principals that I created via PowerShell, in order to delete them.
It would be best if Get-AzureRmADApplication and Get-AzureRmADServicePrincipal had a way to specify -OwnerEmail or -CreatorEmail (or similar), so that I could get all of these objects I created, and then remove them.
Without this ability, there is no way to get/query the objects that I need to delete, in order to solve the quota issue. The existing objects are effectively orphaned.
thank you.
@shuagarw can you take a look?
@darshanhs90 do you know if this is information we can get from the server? Currently, this information is not found in the Application object that is returned from the server when listing applications for a tenant. If there is no way for us to get this information, then we should close the issue.
Is there any update on this?
I just experienced the same limit as the OP. I started searching for a way to identify the list of objects I've created but came up short.
I stumbled across the Get-AzureADObjectByObjectId cmdlet, which seems highly related (although the ByObjectId aspect makes it too restrictive).
Thanks!
Get-AzureADUserCreatedObject -All $true -ObjectId "<Alias or ObjectId of Owner>" seems to work...
I found that the cause of this issue for me was testing a script that tore down and rebuilt environments. I was deleting and creating applications at a somewhat rapid pace. Deleted objects still count towards your 250 object limit.
I was able to filter the objects I created down to those that were deleted and still counting towards my limit by adding the following filter:
Get-AzureADUserCreatedObject -All $true -ObjectId "<Alias or ObjectId of Owner>" | Where-Object {$_.DeletionTimeStamp -ne $null }
I attempt to remove the deleted applications using the corresponding Remove-AzureADMSDeletedDirectoryObject I get the following error:
Remove-AzureADMSDeletedDirectoryObject : Error occurred while executing RemoveMSDeletedItem
Code: Request_BadRequest
Message: Unsupported directory object class 'Application' specified by resource identifier.
InnerError:
RequestId: <redacted guid>
DateTimeStamp: Mon, 16 Apr 2018 14:55:47 GMT
HttpStatusCode: BadRequest
HttpStatusDescription: Bad Request
HttpResponseStatus: Completed
I'm not sure why it wouldn't support the Application type of object. I understand that there may be some caution especially around multi tenant apps, but I've already successfully removed the app and in order to do that, I had to unset a multi tenant flag in the manifest. I had to be pretty intentional in getting the app into this state. I'm just speculating at why removing Applications isn't supported though.
This is an area of the AzureAD module that seems to be in active development. Get-AzureADMSDeletedGroup and Remove-AzureADMSDeletedDirectoryObject were just released to the GA AzureAD module last Friday.
I hope to be able to delete these apps because otherwise I have to wait a month for the recycle bin to clear. I'll need to be much more judicious in committing to executing a test.
@pauldalyii, have you ever get this resolved (other than waiting a month)? I am having the same issue and waiting a month does not seem like an option...
@konstantin-fugue, sorry for the delayed reply, but no... I've updated the environment-provisioning scripts to retain the applications by default and will only intentionally remove if i know there are changes and I can't script the modification of the app in some way to affect those changes.
:bell: Routing this issue to @act-identity-squad.
The AzureRM module (including Get-AzureRmADApplication / Get-AzureRmADServicePrincipal) is retired. Closing as obsolete. If you're hitting a specific gap on the current Az.Resources cmdlets (Get-AzADApplication, Get-AzADServicePrincipal), please open a fresh issue against those.