Tutorial: Setup your Enterprise Calendar Bot
Create your project in Composer
The Enterprise Calendar Bot template is included in the Bot Framework Composer by default. Follow these steps to create a project:
- Open Bot Framework Composer (version 2.0.0 or higher)
- Click Create new
- Select Enterprise Calendar Bot from the list
- Enter your desired Name, Location, and Runtime type then select Create
Provision Azure resources
The Enterprise Calendar Bot requires Azure resources in order to run locally. Follow these steps to provisioned the required resources:
-
Create a publishing profile and provision resources according to the steps in Publish a bot to Azure. The following resources are required for local development:
- Microsoft Application Registration
- Azure Hosting
- Microsoft Bot Channels Registration
- Microsoft Language Understanding Authoring Account
-
Fill in the following settings in Configure > Development Resources with the resources you provisioned:
- Language Understanding authoring key
- Microsoft App Id
- Microsoft App Password
Configure authentication
You must configure an authentication connection on your Azure Bot in order to log in and access Microsoft Graph resources. You can configure these settings either through the Azure Portal or via the Azure CLI.
Option 1: Using the Azure Portal
-
Open your Azure Bot resource and go to the Configuration tab
-
Click Add OAuth Connection Settings
-
Assign your connection setting a name (save this value for later)
-
Select Azure Active Directory v2 from the Service Provider dropdown.
-
Fill in the following fields and click Save:
- Client id: your Microsoft App ID
- Client secret: your Microsoft App Password
- Tenant ID: your Azure Active Directory tenant ID, or "common" to support any tenant
- Scopes: Calendars.ReadWrite Contacts.Read People.Read User.ReadBasic.All User.Read
-
In the Configuration tab, click Manage next to your Microsoft App ID
-
In the API permissions tab, click Add a permission
-
Click Microsoft Graph > Delegated Permissions and add the following scopes:
- Calendars.ReadWrite
- Contacts.Read
- People.Read
- User.ReadBasic.All
- User.Read
-
In the Authentication tab, click Add a platform
- Select Web
- Set the URL to https://token.botframework.com/.auth/web/redirect
-
In Bot Framework Composer, open your Project Settings and toggle the Advanced Settings View
-
Set the following property to the value from Step 3:
{ "oauthConnectionName": "Outlook", }
Option 2: Using Azure CLI
-
Get your Microsoft App Object ID (used in later steps):
az ad app show --id <bot-app-id> --query objectId
-
Set the Redirect URL on your Microsoft App:
az rest --method patch --url https://graph.microsoft.com/v1.0/applications/<objectId> --body "{'web': {'redirectUris': ['https://token.botframework.com/.auth/web/redirect']}}"
-
Add the required Microsoft Graph scopes to your Microsoft App:
az rest --method patch --url https://graph.microsoft.com/v1.0/applications/<objectId> --body "{ 'requiredResourceAccess': [{'resourceAppId': '00000003-0000-0000-c000-000000000000', 'resourceAccess': [ { 'type': 'Scope', 'id': 'ba47897c-39ec-4d83-8086-ee8256fa737d' }, { 'type': 'Scope', 'id': 'ff74d97f-43af-4b68-9f2a-b77ee6968c5d' }, { 'type': 'Scope', 'id': '1ec239c2-d7c9-4623-a91a-a9775856bb36' }, { 'type': 'Scope', 'id': 'b340eb25-3456-403f-be2f-af7a0d370277' }, { 'type': 'Scope', 'id': 'e1fe6dd8-ba31-4d61-89e7-88639da4683d' } ]} ]}"
-
Add your OAuth setting to your Azure Bot Service. The values for
bot-name
,bot-rg
,bot-app-id
, andbot-app-secret
can be found in your bot's publish profile under Publish > Publishing profile > Edit > Import existing resources > Next.az bot authsetting create --name <bot-name> --resource-group <bot-rg> --client-id <bot-app-id> --client-secret <bot-app-secret> --service "Aadv2" --setting-name "Outlook" --provider-scope-string "Calendars.ReadWrite Contacts.Read People.Read User.Read User.ReadBasic.All" --parameters clientId="<bot-app-id>" clientSecret="<bot-app-secret>" tenantId=common
-
Update your Bot settings with your OAuth Connection name in the Advanced Settings View:
{ "oauthConnectionName": "Outlook", }
Next steps
After you have completed the preceding steps to run and test locally, you can follow these steps to publish your bot to Azure:
Publish to Azure
To publish your Enterprise Calendar Bot, follow these steps:
-
Create a publishing profile and provision resources according to the steps in Publish a bot to Azure. The following resources are required for production environments:
- Microsoft Application Registration
- Azure Hosting
- Microsoft Bot Channels Registration
- Azure Cosmos DB
- Application Insights
- Microsoft Language Understanding Authoring Account
- Microsoft Language Understanding Prediction Account
-
Publish your bot via the Publish tab