Adding repairs oauth-validated-csharp#149
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new C# sample for a Microsoft 365 Copilot declarative agent backed by an OAuth-secured Azure Functions API that validates Entra ID access tokens in code.
Changes:
- Adds the C# Azure Functions repairs API, data model, sample data, and project/solution files.
- Adds Microsoft 365 Agents Toolkit configuration, app package manifests, OpenAPI plugin definition, OAuth/AAD manifest, and Azure deployment infrastructure.
- Adds sample documentation, metadata, and ignore rules.
Reviewed changes
Copilot reviewed 27 out of 30 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
samples/da-repairs-oauth-validated-csharp/.gitignore |
Adds ignore rules for build, VS, and generated toolkit files. |
samples/da-repairs-oauth-validated-csharp/README.md |
Documents the sample purpose, prerequisites, and setup flow. |
samples/da-repairs-oauth-validated-csharp/RepairsApi.slnx |
Adds the Visual Studio solution tying API and agent projects together. |
samples/da-repairs-oauth-validated-csharp/RepairsApi/RepairsApi.csproj |
Defines the .NET isolated Azure Functions project and dependencies. |
samples/da-repairs-oauth-validated-csharp/RepairsApi/Program.cs |
Adds the Functions isolated worker host startup. |
samples/da-repairs-oauth-validated-csharp/RepairsApi/RepairsFunction.cs |
Adds the repairs HTTP endpoint with token validation and filtering. |
samples/da-repairs-oauth-validated-csharp/RepairsApi/RepairsData.cs |
Loads repair data from JSON into memory. |
samples/da-repairs-oauth-validated-csharp/RepairsApi/Models/RepairModels.cs |
Defines the repair data model. |
samples/da-repairs-oauth-validated-csharp/RepairsApi/repairsData.json |
Adds sample repair records. |
samples/da-repairs-oauth-validated-csharp/RepairsApi/host.json |
Adds Azure Functions host logging configuration. |
samples/da-repairs-oauth-validated-csharp/RepairsApi/local.settings.json |
Adds local Functions runtime settings. |
samples/da-repairs-oauth-validated-csharp/RepairsApi/Properties/launchSettings.json |
Adds local launch configuration for the API. |
samples/da-repairs-oauth-validated-csharp/M365Agent/M365Agent.atkproj |
Adds the Agents Toolkit project. |
samples/da-repairs-oauth-validated-csharp/M365Agent/m365agents.yml |
Adds cloud provision/deploy workflow. |
samples/da-repairs-oauth-validated-csharp/M365Agent/m365agents.local.yml |
Adds local provision workflow. |
samples/da-repairs-oauth-validated-csharp/M365Agent/launchSettings.json |
Adds Copilot browser launch profiles. |
samples/da-repairs-oauth-validated-csharp/M365Agent/aad.manifest.json |
Adds the Entra app manifest and OAuth scope. |
samples/da-repairs-oauth-validated-csharp/M365Agent/infra/azure.bicep |
Adds Azure Functions infrastructure. |
samples/da-repairs-oauth-validated-csharp/M365Agent/infra/azure.parameters.json |
Adds deployment parameter mappings. |
samples/da-repairs-oauth-validated-csharp/M365Agent/env/.env.dev |
Adds initial dev environment variables. |
samples/da-repairs-oauth-validated-csharp/M365Agent/env/.env.local |
Adds initial local environment variables. |
samples/da-repairs-oauth-validated-csharp/M365Agent/appPackage/manifest.json |
Adds Teams/M365 app manifest. |
samples/da-repairs-oauth-validated-csharp/M365Agent/appPackage/repairDeclarativeAgent.json |
Adds declarative agent definition. |
samples/da-repairs-oauth-validated-csharp/M365Agent/appPackage/instruction.txt |
Adds agent instructions. |
samples/da-repairs-oauth-validated-csharp/M365Agent/appPackage/ai-plugin.json |
Adds API plugin runtime and response semantics. |
samples/da-repairs-oauth-validated-csharp/M365Agent/appPackage/apiSpecificationFile/repair.yml |
Adds OpenAPI definition for the repairs endpoint. |
samples/da-repairs-oauth-validated-csharp/assets/sample.json |
Adds gallery/sample catalog metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: 'AAD_APP_TENANT_ID' | ||
| value: aadAppTenantId | ||
| } | ||
| { |
| appSettings: [ | ||
| { | ||
| name: 'FUNCTIONS_EXTENSION_VERSION' | ||
| value: '~4' | ||
| } | ||
| { | ||
| name: 'FUNCTIONS_WORKER_RUNTIME' | ||
| value: 'dotnet-isolated' | ||
| } |
There was a problem hiding this comment.
Fixed, added a Storage Account resource and the AzureWebJobsStorage app setting to the Bicep template.
| metadataUrl, new OpenIdConnectConfigurationRetriever()); | ||
| } | ||
|
|
||
| var openIdConfig = await _configManager.GetConfigurationAsync(); |
There was a problem hiding this comment.
Fixed. It defaults to CancellationToken.None but I've added an explicit CancellationToken.None for clarity.
| "Values": { | ||
| "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated" | ||
| } |
There was a problem hiding this comment.
Added in gitignore.
| # This file includes environment variables that can be committed to git. It's gitignored by default because it represents your local development environment. | ||
|
|
||
| # Built-in environment variables | ||
| TEAMSFX_ENV=local | ||
| APP_NAME_SUFFIX=local | ||
|
|
||
| # Generated during provision, you can also add your own variables. | ||
| TEAMS_APP_ID= | ||
| TEAMS_APP_TENANT_ID= | ||
|
|
||
| OPENAPI_SERVER_URL= | ||
| BOT_DOMAIN= | ||
| M365_TITLE_ID= | ||
| M365_APP_ID= | ||
| AAD_APP_CLIENT_ID= | ||
| AAD_APP_OBJECT_ID= | ||
| AAD_APP_TENANT_ID= | ||
| AAD_APP_OAUTH_AUTHORITY= | ||
| AAD_APP_OAUTH_AUTHORITY_HOST= | ||
| AAD_APP_ACCESS_AS_USER_PERMISSION_ID= | ||
| OAUTH2AUTHCODE_CONFIGURATION_ID= | ||
| TEAMSFX_M365_USER_NAME= | ||
| DEV_TUNNEL_URL= No newline at end of file |
There was a problem hiding this comment.
we can ignore this.
| { | ||
| "id": "4", | ||
| "title": "Battery replacement", | ||
| "description": "Remove the old battery and install a new one to ensure that the vehicle start reliably and the electrical systems function properly.", |
| "references": [ | ||
| { | ||
| "name": "Microsoft 365 Copilot extensibility", | ||
| "description": "Learn more about what Microsoft 365 Copilot and how you can extend it.", |
| name: 'AAD_APP_CLIENT_SECRET' | ||
| value: aadAppClientSecret | ||
| } | ||
| { |
There was a problem hiding this comment.
we can safely ignore this.
| }, | ||
| "name": { | ||
| "short": "Repairs-OAuth", | ||
| "full": "Full name for Repairs-OAuth" |
| "name": "Teams App, Inc.", | ||
| "websiteUrl": "https://www.example.com", | ||
| "privacyUrl": "https://www.example.com/privacy", | ||
| "termsOfUseUrl": "https://www.example.com/termsofuse" |
There was a problem hiding this comment.
No changes required.
No description provided.