Skip to content

Adding repairs oauth-validated-csharp#149

Draft
YugalPradhan31 wants to merge 2 commits into
pnp:mainfrom
YugalPradhan31:da-repairs-oauth-validated-csharp
Draft

Adding repairs oauth-validated-csharp#149
YugalPradhan31 wants to merge 2 commits into
pnp:mainfrom
YugalPradhan31:da-repairs-oauth-validated-csharp

Conversation

@YugalPradhan31

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}
{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment on lines +33 to +41
appSettings: [
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4'
}
{
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'dotnet-isolated'
}

@YugalPradhan31 YugalPradhan31 May 19, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, added a Storage Account resource and the AzureWebJobsStorage app setting to the Bicep template.

metadataUrl, new OpenIdConnectConfigurationRetriever());
}

var openIdConfig = await _configManager.GetConfigurationAsync();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. It defaults to CancellationToken.None but I've added an explicit CancellationToken.None for clarity.

Comment on lines +3 to +5
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in gitignore.

Comment on lines +1 to +23
# 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.",

@YugalPradhan31 YugalPradhan31 May 19, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

"references": [
{
"name": "Microsoft 365 Copilot extensibility",
"description": "Learn more about what Microsoft 365 Copilot and how you can extend it.",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment on lines +55 to +58
name: 'AAD_APP_CLIENT_SECRET'
value: aadAppClientSecret
}
{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can safely ignore this.

},
"name": {
"short": "Repairs-OAuth",
"full": "Full name for Repairs-OAuth"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Comment on lines +7 to +10
"name": "Teams App, Inc.",
"websiteUrl": "https://www.example.com",
"privacyUrl": "https://www.example.com/privacy",
"termsOfUseUrl": "https://www.example.com/termsofuse"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes required.

@garrytrinder garrytrinder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the C# port! A couple of issues to fix:

  1. Missing additionalMetadata.sampleTag in m365agents.yml: Please add the following after the version property:
additionalMetadata:
  sampleTag: pnp-copilot-pro-dev:da-repairs-oauth-validated-csharp
  1. sample.json PLATFORM metadata: The PLATFORM value is set to Copilot — should be .NET to match the technology used.

@garrytrinder garrytrinder marked this pull request as draft June 8, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants