Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/build-complete-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ jobs:

- project_path: 'samples/bot-file-upload/csharp/TeamsFileUpload/TeamsFileUpload.csproj'
name: 'bot-file-upload'
version: '6.0.x'
version: '10.0.x'

- project_path: 'samples/bot-initiate-thread-in-channel/csharp/TeamsStartNewThreadInTeam/TeamsStartNewThreadInTeam.csproj'
name: 'bot-initiate-thread-in-channel'
version: '6.0.x'

- project_path: 'samples/bot-message-reaction/csharp/MessageReaction/MessageReaction.csproj'
name: 'bot-message-reaction'
version: '8.0.x'
version: '10.0.x'

- project_path: 'samples/bot-suggested-actions/csharp/SuggestedActions/SuggestedActionsBot.csproj'
name: 'bot-suggested-actions'
Expand Down
10 changes: 10 additions & 0 deletions samples/bot-file-upload/csharp/M365Agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# TeamsFx files
build
appPackage/build
env/.env.*.user
env/.env.local
appsettings.Development.json
.deployment

# User-specific files
*.user
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.TeamsFx.Sdk">
<PropertyGroup Label="Globals">
<ProjectGuid>3df7dbbf-6757-c96e-d6ec-3928332da9e0</ProjectGuid>
<ProjectGuid>b069b3bd-f6bc-cc40-82ab-3fcc2ea50fdf</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<None Include="m365agents.local.yml" />
<None Include="m365agents.yml" />
</ItemGroup>
<ItemGroup>
<ProjectCapability Include="ProjectConfigurationsDeclaredDimensions" />
</ItemGroup>
Expand Down
14 changes: 0 additions & 14 deletions samples/bot-file-upload/csharp/M365Agent/M365Agent.ttkproj

This file was deleted.

41 changes: 0 additions & 41 deletions samples/bot-file-upload/csharp/M365Agent/aad.manifest.json

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json",
"manifestVersion": "1.19",
"version": "1.0",
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.23/MicrosoftTeams.schema.json",
"manifestVersion": "1.23",
"version": "1.0.0",
"id": "${{TEAMS_APP_ID}}",
"developer": {
"name": "Microsoft Corp",
Expand All @@ -18,13 +18,13 @@
"full": "This bot sample for Teams demonstrates file upload capabilities using Bot Framework v4, enabling users to upload files and view inline images within chats."
},
"icons": {
"outline": "icon-outline.png",
"color": "icon-color.png"
"outline": "outline.png",
"color": "color.png"
},
"accentColor": "#abcdef",
"bots": [
{
"botId": "${{AAD_APP_CLIENT_ID}}",
"botId": "${{BOT_ID}}",
"scopes": [
"personal"
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions samples/bot-file-upload/csharp/M365Agent/env/.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file includes environment variables that will be committed to git by default.

# Built-in environment variables
TEAMSFX_ENV=dev
APP_NAME_SUFFIX=dev

# Updating AZURE_SUBSCRIPTION_ID or AZURE_RESOURCE_GROUP_NAME after provision may also require an update to RESOURCE_SUFFIX, because some services require a globally unique name across subscriptions/resource groups.
AZURE_SUBSCRIPTION_ID=
AZURE_RESOURCE_GROUP_NAME=
RESOURCE_SUFFIX=

# Generated during provision, you can also add your own variables.
BOT_ID=
TEAMS_APP_ID=
BOT_AZURE_APP_SERVICE_RESOURCE_ID=
3 changes: 3 additions & 0 deletions samples/bot-file-upload/csharp/M365Agent/env/.env.dev.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file includes environment variables that will not be committed to git by default. You can set these environment variables in your CI/CD system for your project.

# Secrets. Keys prefixed with `SECRET_` will be masked in Microsoft 365 Agents Toolkit logs.
14 changes: 1 addition & 13 deletions samples/bot-file-upload/csharp/M365Agent/env/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,8 @@ APP_NAME_SUFFIX=local
# Generated during provision, you can also add your own variables.
BOT_ID=
TEAMS_APP_ID=
RESOURCE_SUFFIX=
AAD_APP_CLIENT_ID=
AAD_APP_OBJECT_ID=
AAD_APP_TENANT_ID=
AAD_APP_OAUTH_AUTHORITY=
AAD_APP_OAUTH_AUTHORITY_HOST=
TEAMS_APP_TENANT_ID=
MICROSOFT_APP_TYPE=
MICROSOFT_APP_TENANT_ID=
AZURE_SUBSCRIPTION_ID=
AZURE_RESOURCE_GROUP_NAME=



BOT_OBJECT_ID=
TEAMSFX_M365_USER_NAME=

BOT_ENDPOINT=
Expand Down
5 changes: 5 additions & 0 deletions samples/bot-file-upload/csharp/M365Agent/env/.env.local.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file includes environment variables that will not be committed to git by default. You can set these environment variables in your CI/CD system for your project.

# Secrets. Keys prefixed with `SECRET_` will be masked in Microsoft 365 Agents Toolkit logs.
SECRET_BOT_PASSWORD=
TEAMS_APP_UPDATE_TIME=
96 changes: 69 additions & 27 deletions samples/bot-file-upload/csharp/M365Agent/infra/azure.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,84 @@
@description('Used to generate names for all resources in this file')
param resourceBaseName string

@description('Required when create Azure Bot service')
param botAadAppClientId string

param botAppDomain string
param webAppSKU string

@maxLength(42)
param botDisplayName string

param botServiceName string = resourceBaseName
param botServiceSku string = 'F0'
param microsoftAppType string
param microsoftAppTenantId string
param serverfarmsName string = resourceBaseName
param webAppName string = resourceBaseName
param identityName string = resourceBaseName
param location string = resourceGroup().location

// Register your web service as a bot with the Bot Framework
resource botService 'Microsoft.BotService/botServices@2021-03-01' = {
kind: 'azurebot'
location: 'global'
name: botServiceName
properties: {
displayName: botDisplayName
endpoint: 'https://${botAppDomain}/api/messages'
msaAppId: botAadAppClientId
msaAppType: microsoftAppType
msaAppTenantId: microsoftAppType == 'SingleTenant' ? microsoftAppTenantId : ''
}
resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
location: location
name: identityName
}

// Compute resources for your Web App
resource serverfarm 'Microsoft.Web/serverfarms@2021-02-01' = {
kind: 'app'
location: location
name: serverfarmsName
sku: {
name: botServiceSku
name: webAppSKU
}
}

// Connect the bot service to Microsoft Teams
resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@2021-03-01' = {
parent: botService
location: 'global'
name: 'MsTeamsChannel'
// Web App that hosts your bot
resource webApp 'Microsoft.Web/sites@2021-02-01' = {
kind: 'app'
location: location
name: webAppName
properties: {
channelName: 'MsTeamsChannel'
serverFarmId: serverfarm.id
httpsOnly: true
siteConfig: {
appSettings: [
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '1'
}
{
name: 'Teams__ClientId'
value: identity.properties.clientId
}
{
name: 'Teams__TenantId'
value: identity.properties.tenantId
}
{
name: 'Teams__BotType'
value: 'UserAssignedMsi'
}
]
ftpsState: 'FtpsOnly'
}
}
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${identity.id}': {}
}
}
}

// Register your web service as a bot with the Bot Framework
module azureBotRegistration './botRegistration/azurebot.bicep' = {
name: 'Azure-Bot-registration'
params: {
resourceBaseName: resourceBaseName
identityClientId: identity.properties.clientId
identityResourceId: identity.id
identityTenantId: identity.properties.tenantId
botAppDomain: webApp.properties.defaultHostName
botDisplayName: botDisplayName
}
}

// The output will be persisted in .env.{envName}. Visit https://aka.ms/teamsfx-actions/arm-deploy for more details.
output BOT_AZURE_APP_SERVICE_RESOURCE_ID string = webApp.id
output BOT_DOMAIN string = webApp.properties.defaultHostName
output BOT_ID string = identity.properties.clientId
output BOT_TENANT_ID string = identity.properties.tenantId
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceBaseName": {
"value": "bot${{RESOURCE_SUFFIX}}"
},
"botAadAppClientId": {
"value": "${{AAD_APP_CLIENT_ID}}"
},
"botAppDomain": {
"value": "${{BOT_DOMAIN}}"
},
"botDisplayName": {
"value": "TestBot"
},
"microsoftAppType": {
"value": "${{MICROSOFT_APP_TYPE}}"
},
"microsoftAppTenantId": {
"value": "${{MICROSOFT_APP_TENANT_ID}}"
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceBaseName": {
"value": "bot${{RESOURCE_SUFFIX}}"
},
"webAppSKU": {
"value": "B1"
},
"botDisplayName": {
"value": "TeamsFileUpload"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@maxLength(20)
@minLength(4)
@description('Used to generate names for all resources in this file')
param resourceBaseName string

@maxLength(42)
param botDisplayName string

param botServiceName string = resourceBaseName
param botServiceSku string = 'F0'
param identityResourceId string
param identityClientId string
param identityTenantId string
param botAppDomain string

// Register your web service as a bot with the Bot Framework
resource botService 'Microsoft.BotService/botServices@2021-03-01' = {
kind: 'azurebot'
location: 'global'
name: botServiceName
properties: {
displayName: botDisplayName
endpoint: 'https://${botAppDomain}/api/messages'
msaAppId: identityClientId
msaAppMSIResourceId: identityResourceId
msaAppTenantId:identityTenantId
msaAppType:'UserAssignedMSI'
}
sku: {
name: botServiceSku
}
}

// Connect the bot service to Microsoft Teams
resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@2021-03-01' = {
parent: botService
location: 'global'
name: 'MsTeamsChannel'
properties: {
channelName: 'MsTeamsChannel'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `azurebot.bicep` module is provided to help you create Azure Bot service when you don't use Azure to host your app. If you use Azure as infrastrcture for your app, `azure.bicep` under infra folder already leverages this module to create Azure Bot service for you. You don't need to deploy `azurebot.bicep` again.
Loading