-
Notifications
You must be signed in to change notification settings - Fork 11
Add non-Azure hosting support to a365 setup #34
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
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ee78f8e
Add non-Azure hosting support to a365 setup
mengyimicro 0d28403
resolveing comments
mengyimicro 96b48e6
resolveing comments
mengyimicro f9f9a26
fix failed tests
mengyimicro 8657f8d
fix typos
mengyimicro 319fadf
Refactor SetupCommand to use GraphApiService (#36)
sellakumaran c356790
Add SetupValidationException
mengyimicro 3be740a
Add non-Azure hosting support to a365 setup
mengyimicro fb1eb16
resolveing comments
mengyimicro e07c30e
resolveing comments
mengyimicro 926760b
fix failed tests
mengyimicro 43cf118
fix typos
mengyimicro 50f65db
Add SetupValidationException
mengyimicro 2112244
Merge branch 'users/mengyixu/NonAzureDeploymentSetup' of https://gith…
mengyimicro 3344c26
Change needDeploy to bool
mengyimicro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
195 changes: 138 additions & 57 deletions
195
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Microsoft.Agents.A365.DevTools.Cli/Exceptions/GraphTokenScopeException.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.Agents.A365.DevTools.Cli.Constants; | ||
|
|
||
| namespace Microsoft.Agents.A365.DevTools.Cli.Exceptions; | ||
|
|
||
| /// <summary> | ||
| /// Exception thrown when a Graph access token contains disallowed high-privilege scopes. | ||
| /// </summary> | ||
| public class GraphTokenScopeException : Agent365Exception | ||
| { | ||
| private const string IssueDescriptionText = "Graph token contains high-privilege scopes"; | ||
|
|
||
| public GraphTokenScopeException(string scope) | ||
| : base( | ||
| errorCode: ErrorCodes.HighPrivilegeScopeDetected, | ||
| issueDescription: IssueDescriptionText, | ||
| errorDetails: new List<string> { $"Disallowed scope detected in token: {scope}" }, | ||
| mitigationSteps: new List<string> | ||
| { | ||
| "Check Microsoft Graph Command Line Tools app permissions: Azure portal ? App registrations ? 'Microsoft Graph Command Line Tools' (App ID: 14d82eec-204b-4c2f-b7e8-296a70dab67e) ? API permissions.", | ||
| "Look for 'Directory.AccessAsUser.All' and remove it or replace it with a least-privilege alternative (for example 'Directory.Read.All') if appropriate.", | ||
| "Re-run the CLI and, when the browser consent prompt appears, approve only the scopes requested by the CLI.", | ||
| "Note: Removing tenant-wide admin consent for this permission may impact other tools or automation that rely on it. Verify impact before removal." | ||
| }) | ||
| { | ||
| } | ||
|
|
||
| public override int ExitCode => 2; // Configuration / permission error | ||
| } | ||
30 changes: 30 additions & 0 deletions
30
src/Microsoft.Agents.A365.DevTools.Cli/Exceptions/SetupValidationException.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.Agents.A365.DevTools.Cli.Constants; | ||
|
|
||
| namespace Microsoft.Agents.A365.DevTools.Cli.Exceptions; | ||
|
|
||
| /// <summary> | ||
| /// Validation errors that occur during `a365 setup` (user-fixable issues). | ||
| /// </summary> | ||
| public sealed class SetupValidationException : Agent365Exception | ||
| { | ||
| public override int ExitCode => 2; | ||
|
|
||
| public SetupValidationException( | ||
| string issueDescription, | ||
| List<string>? errorDetails = null, | ||
| List<string>? mitigationSteps = null, | ||
| Dictionary<string, string>? context = null, | ||
| Exception? innerException = null) | ||
| : base( | ||
| errorCode: ErrorCodes.SetupValidationFailed, | ||
| issueDescription: issueDescription, | ||
| errorDetails: errorDetails, | ||
| mitigationSteps: mitigationSteps, | ||
| context: context, | ||
| innerException: innerException) | ||
| { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.