`az ad sp list` should by default show the first few pages, rather just hang to get all of them
Kinda says it all
are you using your microsoft.com account? If yes, then this hangs might be just long-delay. Not saying this is ideal, but there are 100k+ users account to retrieve. There are server side filters you can use to narrow down the data.
The cli need to support streaming (start to display before all data are pulled down), rather wait for thousands of get operations returned.
I was wondering if az ad sp list can have an option (or by default) to show MY service principals rather than ALL service principals. For applications, the portal has an option to show All apps or My apps. It doesn't make sense to me if by default it returns all service principals.
@yugangw-msft : List vs list-all?
It winds down to whether there is ownership such information inside the graph application object. AFAIK, there are not.
The following is the object dump
{
"odata.type": "Microsoft.DirectoryServices.Application",
"objectType": "Application",
"objectId": "005b1e87-7383-4f8c-9a84-a913f9137a49",
"deletionTimestamp": null,
"appId": "0675995d-e1dc-4943-beb6-4df25e02c6d5",
"appRoles": [],
"availableToOtherTenants": false,
"displayName": "updated Saml display name",
"errorUrl": null,
"groupMembershipClaims": null,
"homepage": null,
"identifierUris": [
"http://samlCustom",
"http://customappsso/d18d09a13dd340fa8b6a1733bad042e1/"
],
"keyCredentials": [],
"knownClientApplications": [],
"logoutUrl": null,
"oauth2AllowImplicitFlow": false,
"oauth2AllowUrlPathMatching": false,
"oauth2Permissions": [
{
"adminConsentDescription": "Allow the application to access SAML Custom App #2 on behalf of the signed-in user.",
"adminConsentDisplayName": "Access SAML Custom App #2",
"id": "5279cafd-2efd-4067-9a05-2e4d529876c0",
"isEnabled": true,
"type": "User",
"userConsentDescription": "Allow the application to access SAML Custom App #2 on your behalf.",
"userConsentDisplayName": "Access SAML Custom App #2",
"value": "user_impersonation"
}
],
"oauth2RequirePostResponse": false,
"passwordCredentials": [],
"publicClient": null,
"replyUrls": [
"https://samlCustom"
],
"requiredResourceAccess": [
{
"resourceAppId": "00000002-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "5778995a-e1bf-45b8-affa-663a9f3f4d04",
"type": "Role"
}
]
}
],
"samlMetadataUrl": null
}
The portal does have a way to show My apps or All apps with two different calls in Azure Active Directory extension.
@djyou Again, could you please share the object dump, which you can get by downloading the manifest from portal, or just use graph explorer. Only if there is a property in the graph, then we can filter; otherwise it is a portal specific UI profile setting which can't be used by cli command.
I agreed that the manifest doesn't have user information. It was just interesting to see the portal can actually do My apps vs All apps. I am not too familiar with Graph API just curious how they did it.
@djyou, you will have to ask portal team. To me it is a very UI related. First I have to make sure the combo has 'my apps' selected, otherwise the new application will be created under 'all apps', even though it was me who created. Also all applications I created in classic portal belong to "all apps" which doesn't make too much sense
I logged #3323 for the original perf issue. Closing this one as it was re-topic'd
I don't find this resolution acceptable. Streaming isn't going to help. We need to do what the portal does and by default show just my sps.
Actually, it appears portal shows the first page, which is still better than CLI just hanging there. Suggest CLI should align to that behavior, and also outputs a warning to tell people
- There are more
- Suggest supplying arguments to accelerate the command through
--spn,--display-name, etc...
@yugangw-msft the problem with the suggestion of 2, is that you'd NEVER use list if you really knew what you were looking for. You'd just use show. By definition, list must return. I'm with john here; we need to return my SPs by default.
+1 ... in fact, I'd also suggest that the portal default to "My apps"
CLI probably should also expose a new flag --my-apps or --all, depending on what the default should be.
That would be a fine resolution, but the default should be my apps, where you specifically request the firehose with --all if you want it, but risk it never returning (until there's paging)....
What are the chances we can get this popped off the backlog? As working with RBAC service principals becomes more and more common in various services (AKS and ACR, for example), it's becoming critical that we and our customers can effectively manage our SPs.
Such management includes deletion of stale principals, but without a built-in facility for listing only the service principals associated with my subscription, I've no clear path to delete them quickly and easily (such as via script).
cc/ @yugangw-msft @mayurid
2 things
- Paging support from CLI
- GraphRBAC should be updated to support
https://graph.windows.net/{tenantId}/me/ownedObjectsso CLI can create and list users' own SPs
The 2nd item is SDK work. I have asked last month, but AAD GRAPH is not in the priority. Guess I will have to find cycles, and do it myself
OMG. @yugangw-msft ping me and let me know who to discuss this with. :-) This is a very high priority for some. :-)