{"record":{"id":"210d0f8046223d5e","repo":"microsoft/semantic-kernel","slug":"missing-scopes-configuration-for-microsoft-graph-a-210d0f","errorCode":null,"errorMessage":"Missing Scopes configuration for Microsoft Graph API.","messagePattern":"Missing Scopes configuration for Microsoft Graph API\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/samples/Concepts/Plugins/CopilotAgentBasedPlugins.cs","lineNumber":225,"sourceCode":"            }\n        }\n    }\n    private static readonly RestApiParameterFilter s_restApiParameterFilter = (RestApiParameterFilterContext context) =>\n    {\n        if ((\"me_sendMail\".Equals(context.Operation.Id, StringComparison.OrdinalIgnoreCase) ||\n            (\"me_calendar_CreateEvents\".Equals(context.Operation.Id, StringComparison.OrdinalIgnoreCase)) &&\n            \"payload\".Equals(context.Parameter.Name, StringComparison.OrdinalIgnoreCase)))\n        {\n            context.Parameter.Schema = TrimPropertiesFromRequestBody(context.Parameter.Schema);\n            return context.Parameter;\n        }\n        return context.Parameter;\n    };\n    internal static async Task<CopilotAgentPluginParameters> GetAuthenticationParametersAsync()\n    {\n        if (TestConfiguration.MSGraph.Scopes is null)\n        {\n            throw new InvalidOperationException(\"Missing Scopes configuration for Microsoft Graph API.\");\n        }\n\n        LocalUserMSALCredentialManager credentialManager = await LocalUserMSALCredentialManager.CreateAsync().ConfigureAwait(false);\n\n        var token = await credentialManager.GetTokenAsync(\n                        TestConfiguration.MSGraph.ClientId,\n                        TestConfiguration.MSGraph.TenantId,\n                        TestConfiguration.MSGraph.Scopes.ToArray(),\n                        TestConfiguration.MSGraph.RedirectUri).ConfigureAwait(false);\n#pragma warning restore SKEXP0050\n\n        BearerAuthenticationProviderWithCancellationToken authenticationProvider = new(() => Task.FromResult(token));\n#pragma warning disable SKEXP0040\n\n        // Microsoft Graph API execution parameters\n        var graphOpenApiFunctionExecutionParameters = new OpenApiFunctionExecutionParameters(\n            authCallback: authenticationProvider.AuthenticateRequestAsync,\n            serverUrlOverride: new Uri(\"https://graph.microsoft.com/v1.0\"),","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/samples/Concepts/Plugins/CopilotAgentBasedPlugins.cs#L207-L243","documentation":"Error \"Missing Scopes configuration for Microsoft Graph API.\" thrown in microsoft/semantic-kernel.","triggerScenarios":"Thrown at dotnet/samples/Concepts/Plugins/CopilotAgentBasedPlugins.cs:225 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a 'Scopes' entry to the Microsoft Graph API configuration in the Copilot agent manifest so the required permissions can be requested.","Confirm the manifest's runtime configuration points to the Microsoft Graph resource with at least one scope defined."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}