Skip to content

Commit 13fbf97

Browse files
Merge branch 'main' into patch-1
2 parents 2461392 + c66bb94 commit 13fbf97

File tree

84 files changed

+1989
-812
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1989
-812
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Scripts
2+
3+
- `decompose.ps1`
4+
- This command will configuration details for the Azure Bot Service resource, including its Connections and Channels. If an application ID is provided, the script will also print the configuration of the App Registration.
5+
- Usage:
6+
```bash
7+
./decompose.ps1 -g RESOURCE_GROUP -n BOT_NAME -APP_ID OPTIONAL_APP_ID
8+
```
9+
10+
11+
- `gen_teams_manifest.ps1`
12+
- This command will create the file `./bot/manifest.json`, allowing you to zip the contents of the `./bot` directory and import the Agent into teams.
13+
- Usage:
14+
```
15+
./gen_teams_manifest.ps1 -APP_ID APP_ID
16+
```
17+
18+
19+
20+
## Directories
21+
22+
- `bicep`: common bicep scripts used by the samples provisioning scripts
23+
24+
- `samples`
25+
- `quickstart`: provisioning script for the Quickstart sample
26+
- `auto-signin`: provisioning scripts for the Auto Sign-In sample
27+
- `obo-authorization`: provisioning scripts for the OBO Authorization sample
28+
29+
- `bot`: Destination of `manifest.json` file created by `gen_teams_manifest.ps1`. The resulting contents can be used to deploy an Agent to Teams.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"experimentalFeaturesEnabled": {
3+
"extensibility": true
4+
},
5+
// specify an alias for the version of the v1.0 dynamic types package you want to use
6+
"extensions": {
7+
"microsoftGraphV1": "br:mcr.microsoft.com/bicep/extensions/microsoftgraph/v1.0:0.2.0-preview"
8+
}
9+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@description('The name of the Azure Bot resource.')
2+
param botName string
3+
4+
@description('The ID for an existing App Registration')
5+
param appId string
6+
7+
@description('The endpoint for the bot service.')
8+
param endpoint string
9+
10+
@description('The location for the bot service.')
11+
param location string
12+
13+
resource azureBot 'microsoft.botService/botServices@2023-09-15-preview' = {
14+
name: botName
15+
location: location
16+
kind: 'azurebot'
17+
properties: {
18+
displayName: botName
19+
msaAppId: appId
20+
endpoint: endpoint
21+
msaAppType: 'SingleTenant'
22+
msaAppTenantId: tenant().tenantId
23+
// schemaTransformationVersion: '1.3'
24+
}
25+
}
26+
27+
resource msteams 'microsoft.botService/botServices/channels@2023-09-15-preview' = {
28+
parent: azureBot
29+
location: location
30+
name: 'MsTeamsChannel'
31+
properties: {
32+
channelName: 'MsTeamsChannel'
33+
}
34+
}
35+
36+
output appId string = azureBot.id
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
extension microsoftGraphV1
2+
3+
param endpoint string
4+
param botName string
5+
6+
@allowed([
7+
'aadv2'
8+
])
9+
param oauthType string = 'aadv2' // for later
10+
var appName = '${botName}-oauth-app'
11+
12+
// for when creating a brand new app registration
13+
// we need to be able to access the app ID
14+
resource appRegistrationBase 'Microsoft.Graph/[email protected]' = {
15+
displayName: appName
16+
uniqueName: appName
17+
signInAudience: 'AzureADMyOrg'
18+
owners: {
19+
relationships: [ deployer().objectId ]
20+
}
21+
22+
// Corresponds to "Authentication" section
23+
web: {
24+
homePageUrl: '${endpoint}/api/messages'
25+
implicitGrantSettings: {
26+
enableAccessTokenIssuance: true
27+
enableIdTokenIssuance: true
28+
}
29+
redirectUris: [
30+
'https://token.botframework.com/.auth/web/redirect'
31+
]
32+
}
33+
publicClient: {
34+
redirectUris: [
35+
'http://localhost'
36+
'msal79e090f7-bb8e-4b24-b966-1e88178962c6://auth'
37+
'https://login.live.com/oauth20_desktop.srf'
38+
'${environment().authentication.loginEndpoint}common/oauth2/nativeclient'
39+
]
40+
}
41+
isFallbackPublicClient: true // idk what this does
42+
43+
// Corresponds to "Expose an API" section
44+
api: {
45+
oauth2PermissionScopes: [
46+
{
47+
adminConsentDescription: 'defaultScope'
48+
adminConsentDisplayName: 'defaultScope'
49+
id: guid(resourceGroup().id, botName, 'defaultScope')
50+
isEnabled: true
51+
type: 'User'
52+
userConsentDescription: 'Allows the bot to access your data.'
53+
userConsentDisplayName: 'Access your data'
54+
value: 'defaultScope'
55+
}
56+
]
57+
preAuthorizedApplications: [
58+
{
59+
appId: '5e3ce6c0-2b1f-4285-8d4b-75ee78787346' // Teams web application
60+
delegatedPermissionIds: [
61+
guid(resourceGroup().id, botName, 'defaultScope')
62+
]
63+
}
64+
{
65+
appId: '1fec8e78-bce4-4aaf-ab1b-5451cc387264' // Teams mobile/desktop application
66+
delegatedPermissionIds: [
67+
guid(resourceGroup().id, botName, 'defaultScope')
68+
]
69+
}
70+
]
71+
}
72+
73+
// Corresponds to "API permmissions" section
74+
requiredResourceAccess: [
75+
{
76+
resourceAppId: '8578e004-a5c6-46e7-913e-12f58912df43' // Power Platform API
77+
resourceAccess: [
78+
{
79+
id: '204440d3-c1d0-4826-b570-99eb6f5e2aeb' // CopilotStudio.Copilots.Invoke
80+
type: 'Scope'
81+
}
82+
]
83+
}
84+
{
85+
resourceAppId: '00000003-0000-0000-c000-000000000000' // Microsoft Graph
86+
resourceAccess: [
87+
{
88+
id: 'e1fe6dd8-ba31-4d61-89e7-88639da4683d' // User.Read
89+
type: 'Scope'
90+
}
91+
{
92+
id: '14dad69e-099b-42c9-810b-d002981feec1' // profile
93+
type: 'Scope'
94+
}
95+
{
96+
id: '37f7f235-527c-4136-accd-4a02d197296e' // openid
97+
type: 'Scope'
98+
}
99+
]
100+
}
101+
{
102+
resourceAppId: '00000007-0000-0000-c000-000000000000' // Dynamics CRM
103+
resourceAccess: [
104+
{
105+
id: '78ce3f0f-a1ce-49c2-8cde-64b5c0896db4' // user_impersonation
106+
type: 'Scope'
107+
}
108+
]
109+
}
110+
]
111+
}
112+
113+
resource servicePrincipal 'Microsoft.Graph/[email protected]' = {
114+
appId: appRegistrationBase.appId
115+
accountEnabled: true
116+
servicePrincipalType: 'Application'
117+
}
118+
119+
// use existing app ID to set up API
120+
// should overwrite existing app registration
121+
resource appRegistration 'Microsoft.Graph/[email protected]' = {
122+
displayName: appName
123+
uniqueName: appName
124+
signInAudience: appRegistrationBase.signInAudience
125+
web: appRegistrationBase.web
126+
publicClient: appRegistrationBase.publicClient
127+
isFallbackPublicClient: appRegistrationBase.isFallbackPublicClient
128+
api: appRegistrationBase.api
129+
requiredResourceAccess: appRegistrationBase.requiredResourceAccess
130+
131+
// Application ID URI from "Expose an API"
132+
identifierUris: [
133+
'api://botid-${appRegistrationBase.appId}'
134+
]
135+
}
136+
137+
output appId string = appRegistration.appId
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
extension microsoftGraphV1
2+
3+
param botName string
4+
5+
resource app 'Microsoft.Graph/[email protected]' = {
6+
displayName: '${botName}-app'
7+
uniqueName: '${botName}-app'
8+
signInAudience: 'AzureADMyOrg'
9+
owners: {
10+
relationships: [ deployer().objectId ]
11+
}
12+
}
13+
14+
resource servicePrincipal 'Microsoft.Graph/[email protected]' = {
15+
appId: app.appId
16+
accountEnabled: true
17+
servicePrincipalType: 'Application'
18+
}
19+
20+
output appId string = app.appId
1.85 KB
Loading
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v/MicrosoftTeams.schema.json",
3+
"version": "1.0.0",
4+
"manifestVersion": "",
5+
"id": "643bbcc0-be45-46d5-838c-b8390347bf49",
6+
"name": {
7+
"short": "Testing Teams SSO Auth",
8+
"full": "Testing Teams Single Sign On Sample"
9+
},
10+
"developer": {
11+
"name": "Microsoft",
12+
"mpnId": "",
13+
"websiteUrl": "https://example.azurewebsites.net",
14+
"privacyUrl": "https://example.azurewebsites.net/privacy",
15+
"termsOfUseUrl": "https://example.azurewebsites.net/termsofuse"
16+
},
17+
"description": {
18+
"short": "1Test Teams SSO Auth",
19+
"full": "1This is a bot for testing Single Sign on for Teams"
20+
},
21+
"icons": {
22+
"outline": "outline.png",
23+
"color": "color.png"
24+
},
25+
"accentColor": "#FFFFFF",
26+
"staticTabs": [
27+
{
28+
"entityId": "conversations",
29+
"name": "Chat",
30+
"scopes": [
31+
"personal"
32+
]
33+
},
34+
{
35+
"entityId": "about",
36+
"name": "",
37+
"scopes": [
38+
"personal"
39+
]
40+
}
41+
],
42+
"bots": [
43+
{
44+
"botId": "79e090f7-bb8e-4b24-b966-1e88178962c6",
45+
"scopes": [
46+
"personal",
47+
"team",
48+
"groupchat"
49+
],
50+
"isNotificationOnly": false,
51+
"supportsCalling": false,
52+
"supportsVideo": false,
53+
"supportsFiles": false
54+
}
55+
],
56+
"validDomains": [
57+
"token.botframework.com",
58+
"ngrok.io"
59+
],
60+
"webApplicationInfo": {
61+
"id": "79e090f7-bb8e-4b24-b966-1e88178962c6",
62+
"resource": "api://botid-79e090f7-bb8e-4b24-b966-1e88178962c6/access_as_user"
63+
}
64+
}
755 Bytes
Loading
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# References for ARM and Graph resource types
2+
# https://learn.microsoft.com/en-us/azure/templates/microsoft.botservice/botservices?pivots=deployment-language-bicep
3+
# https://learn.microsoft.com/en-us/graph/templates/bicep/reference/applications?view=graph-bicep-1.0
4+
5+
[CmdletBinding()]
6+
param(
7+
[Parameter(Mandatory=$true)]
8+
[Alias('g')]
9+
[string]$RESOURCE_GROUP,
10+
11+
[Parameter(Mandatory=$true)]
12+
[Alias('n')]
13+
[string]$BOT_NAME,
14+
15+
[string]$APP_ID=''
16+
)
17+
18+
if ($APP_ID -ne '') {
19+
Write-Output 'Showing App Registration Details:\n'
20+
az ad app show --id $APP_ID
21+
Write-Output '\nAssociated federated-credential list:'
22+
az ad app federated-credential list --id $APP_ID
23+
}
24+
25+
$CHANNEL_NAME_LIST = @('msteams', 'webchat', 'directline')
26+
27+
# Azure Bot Service Channels
28+
Write-Output 'Showing configured channels (from a non-exhaustive list)'
29+
foreach($channel_name in $CHANNEL_NAME_LIST) {
30+
Write-Output "Channel: $channel_name"
31+
az bot $CHANNEL_NAME show -n $BOT_NAME -g $RESOURCE_GROUP
32+
Write-Output '\n'
33+
}
34+
35+
# Azure Bot Service Connections
36+
Write-Output 'Showing connections'
37+
az bot authsetting list -n $BOT_NAME -g $RESOURCE_GROUP
38+
Write-Output '\n'

0 commit comments

Comments
 (0)