Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report: entra app permission remove fails when service principal doesn't exist #6291

Open
waldekmastykarz opened this issue Aug 31, 2024 · 1 comment · May be fixed by #6446
Open

Bug report: entra app permission remove fails when service principal doesn't exist #6291

waldekmastykarz opened this issue Aug 31, 2024 · 1 comment · May be fixed by #6446

Comments

@waldekmastykarz
Copy link
Member

Priority

(Medium) I'm annoyed but I'll live

Description

When you run entra app permission remove --appId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690' --applicationPermissions 'https://graph.microsoft.com/Sites.FullControl.All https://microsoft.sharepoint-df.com/Sites.FullControl.All' --revokeAdminConsent --force and the service principal doesn't exist, the command fails with: Error: Cannot read properties of undefined (reading 'id')

Steps to reproduce

Run the command

Expected results

Command completes

Actual results

Command fails with an error

Diagnostics

No response

CLI for Microsoft 365 version

Latest from main

nodejs version

20

Operating system (environment)

macOS

Shell

zsh

cli doctor

No response

Additional Info

Here:

const appServicePrincipal = servicePrincipals.find(sp => sp.appId === appObject.appId);
await this.revokeAdminConsent(appServicePrincipal!, appPermissions, logger);
, we shouldn't assume that the service principal exists. If it turns out it doesn't, we should skip revoking the consent because there's nothing to revoke it on, but we shouldn't fail with an unhandled exception.

@Adam-it Adam-it added the hacktoberfest Issue perfect for hacktoberfest label Sep 24, 2024
@Saurabh7019
Copy link
Contributor

Can I fix this?

Saurabh7019 added a commit to Saurabh7019/cli-microsoft365 that referenced this issue Oct 22, 2024
@Adam-it Adam-it removed the hacktoberfest Issue perfect for hacktoberfest label Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants