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

Fixes prompting for entra app. Closes #6498 #6499

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/m365/base/AppCommand.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ describe('AppCommand', () => {
}
]
}));
sinon.stub(cli, 'handleMultipleResultsFound').resolves({ appIdIndex: 1 });
sinon.stub(cli, 'handleMultipleResultsFound').resolves({
"appId": "9c79078b-815e-4a3e-bb80-2aaf2d9e9b3d",
"name": "CLI app1"
});
sinon.stub(Command.prototype, 'action').resolves();

try {
Expand Down
9 changes: 6 additions & 3 deletions src/m365/base/AppCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ export default abstract class AppCommand extends Command {
}

if (this.m365rcJson.apps.length > 1) {
const resultAsKeyValuePair = formatting.convertArrayToHashTable('appIdIndex', this.m365rcJson.apps);
const result = await cli.handleMultipleResultsFound<{ appIdIndex: number }>(`Multiple Entra apps found in ${m365rcJsonPath}.`, resultAsKeyValuePair);
this.appId = ((this.m365rcJson as M365RcJson).apps as M365RcJsonApp[])[result.appIdIndex].appId;
this.m365rcJson.apps.forEach((app, index) => {
(app as any).appIdIndex = index;
});
const resultAsKeyValuePair = formatting.convertArrayToHashTable('appId', this.m365rcJson.apps);
const result = await cli.handleMultipleResultsFound<M365RcJsonApp>(`Multiple Entra apps found in ${m365rcJsonPath}.`, resultAsKeyValuePair);
this.appId = result.appId;
await super.action(logger, args);
}
}
Expand Down