Microsoft Teams and Azure services can interact with Teams Extensions and Bots hosted outside of Azure only when they are registered in Azure. See more details in the official Microsoft docs.
Note
The payment plan is subject to your choice (below it says to change the plan to 'Free', but that is not necessary.
To register the Microsoft Azure Bot and configure the OAuth connection to the Alfresco Digital Workspace (ADW) follow these steps:
-
Sign in to the Microsoft Azure Portal:
- If you see a Quick Start page, then remove it by clicking the X to the right.
- Now you should see a page looking something like this:
!!! Note The logged in user must have permission to register bots in Azure Active Directory (AAD).
-
Register the Microsoft Azure Bot:
- Click the Create a resource item under Azure services to start Azure bot registration.
- Type
Azure Botin the search input field and choose the Azure Bot item. - Click Create.
- In the Bot handle field type a unique name for your Bot (cannot be changed later on). Such as
alfresco-teams-integration. - Select desired subscription and resource group. Both are required.
- Click Change plan.
- Select Free.
- Let Azure create a Microsoft App ID for you.
- Your screen should look like this now:
- Click Review + create (optionally you can add tags to your Bot):
- If all pre-checks passed click Create.
- Azure will deploy your registration.
- When complete, click on Go to resource.
- Click on the Configuration menu item to the left under Settings.
-
Set Messaging endpoint to
https://{my.domain}/{teams-service-path}/api/messages. This is the URL that the Collaboration Connector for Teams is exposed on. See below.For example:
https://develop.mycompany.com/ms-teams-service/api/messages -
Copy your Microsoft App ID. For example:
9af7ae3a-1798-4de7-a992-c3ac489e5324. We later refer to this app identifier asMS_BOT_APP_ID. -
Click Apply to save configuration.
-
Configure the OAuth connection to the ADW.
For more information about user authentication see this article.
In the configuration screen:
Click on Add OAuth Connection Settings, a window will appear on the right side of the screen.
A full example on how to set up all the values can be found in the following table:
| Property | Description | Value |
| Name | The name of your connection | Typically this is set to alfresco - when changed it must be reflected in microsoft.app.oauth.connection-name app property when running Alfresco Collaboration Connector for Teams. |
| Service Provider | Identity provider type | From the drop-down list, select Oauth 2 Generic Provider |
| Client ID | Refers to the name of the OAuth client in Keycloak (OAuth) configuration in the Identity Service. | Typically alfresco |
| Client secret | OAuth client secret (if client access is not public), otherwise this field must be filled but the value is irrelevant | random string |
| Scope List Delimiter | The character to use between scope values (often a space or comma) | , <enter comma> |
| Authorization URL Template | Authorization endpoint URL | https://{my.domain}/auth/realms/alfresco/protocol/openid-connect/auth |
| Authorization URL Query String | The query string to append to the authorization URL, templated with any wanted parameters: {ClientId} {ClientSecret} {RedirectUrl} {Scopes} {State} |
?clientid={ClientId}&redirecturi={RedirectUrl}&scope={Scopes}&response_type=code&state={State} |
| Token URL Template | Token endpoint URL | https://{my.domain}/auth/realms/alfresco/protocol/openid-connect/token |
| Token URL Query String Template | Body to send for the token exchange | ? <enter question mark> |
| Token Body Template | Body to send for the token exchange | code={Code}&granttype=authorizationcode&redirecturi={RedirectUrl}&clientid={ClientId}&client_secret={ClientSecret} |
| Refresh URL Template | Token refresh endpoint URL | https://{my.domain}/auth/realms/alfresco/protocol/openid-connect/token |
| Refresh URL Query String Template | The query string to append to the refresh URL, templated with any wanted parameters: {ClientId} {ClientSecret} {RedirectUrl} {Scopes} {State} |
? <enter question mark> |
| Refresh Body Template | Body to send with the token refresh | refreshtoken={RefreshToken}&redirecturi={RedirectUrl}&granttype=refreshtoken&clientid={ClientId}&clientsecret={ClientSecret} |
| Token Exchange URL | Used for SSO in Azure AD v2 | Leave blank |
| Scopes | Comma separated list of the API permissions you granted earlier to the Azure AD authentication app | openid |
After filling in the values you should see a name/value property list looking something like this:
Click Save to validate and store the OAuth configuration.
-
Test the ADW Connection:
- Click on your newly created connection and then click Test Connection:
- If it was successful, then you will be redirected to the ADW login page:
- Enter username and password and click Sign in.
- Once successfully logged in, you should see:
-
Retrieve bot Secret.
If you already had a bot secret but lost it, then skip this section and proceed directly to 6. Already had a bot secret.
This secret is important and is not to be confused with the Oath client secret used above. It is one of the mandatory properties when starting the Collaboration Connector for Teams bot service.
* In the top-most search bar type in `vault` and click on <a href="https://docs.microsoft.com/en-us/azure/key-vault/general/overview" target="_blank">**Key vaults**</a>.
* Click on the item with a name starting with `bot-secrets-*`.
* Choose **Secrets** (vertical) tab.
* The following message is displayed: *The operation "List" is not enabled in this key vault's access policy.*
* Go to **Access Policies** (vertical tab) and click on **Add Access Policy**.
* The easiest way to add it is to choose from a template (‘Configure from template’) named ‘Key, secret, & certificate Management’
(or choose from other, or configure manually). You also need to add a principal responsible for this policy.
* Don’t forget to **Save** Access policies settings.
* You should now be able to access data on **Secrets** (vertical) tab.
* Choose the secret that relates to your bot.
* Click **Show Secret Value** button on bottom of the screen and copy the secret value for reference. We later refer to this secret as `MS_BOT_APP_CLIENT_SECRET_VALUE`.
-
Already had a bot secret? (OPTIONAL):
- Go to the Microsoft Azure Portal.
- Click on your bot name.
- Then click Configuration in the left menu.
- Click Manage in > Microsoft App ID (Manage).
- Click new client secret. Note, if one already exists delete it unless you already have the value, because you can not get it again.
- Give it a description, such as "My secret".
- Click add.
- Now your secret value should be visible. Copy and keep it safe as you only get one chance to see its value.