> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morada.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Teams: install Morada OS in your company's Teams

> For whoever administers the organization: register the company's bot in Azure, link it to Morada OS, send the app to Teams and check that it is working.

With Teams installed, your team talks to the Morada OS assistant without leaving Microsoft Teams: in the personal chat with the app, or by mentioning the app in a team's channel. Each person uses their own Morada OS account, with the same access and the same credits as in the chat, and nothing is done without the OK of whoever asked. See [what it looks like for the people who use it](https://docs.morada.ai/morada-os/en/channels/teams.md).

This page is for whoever **administers the organization** in Morada OS. It takes about 15 minutes, and you do it all on your own, with no one from Morada on a call.

> [!NOTE]
>
> **This is not the Microsoft 365 connector.** The [connector](https://docs.morada.ai/morada-os/en/connectors/microsoft-365.md), in **Conectores** (Connectors), lets the assistant read your email, calendar, files and Teams **as you**, from inside Morada OS. This is the opposite direction: Morada OS becomes **an app** inside your company's Teams, and people talk to it there. Neither depends on the other.

***

## Before you start

* **An Azure subscription** on the company's Microsoft account. The bot lives in your Azure, and the free Azure Bot plan (**F0**) is enough.
* **Permission to create resources in Azure** and to register applications in Microsoft Entra. If your company restricts that, ask whoever administers Azure.
* **Someone with the Teams administrator role** (or global administrator) in Microsoft 365, to send the app to Teams in step 4.
* **The organization's icon**, if you want the app to use it: it comes from **Configurações** (Settings), **Identidade** (Identity), in Morada OS.

The app belongs to your company: the bot is registered in your Azure, under the name you choose, and only serves people from your organization in Microsoft 365.

> [!WARNING]
>
> The command uses the `morada-os-teams` resource group by default. This group holds the bots created by every run of the command in the same subscription, including other installations. Do not delete the group while any of these apps is in use in Teams. To remove one bot, delete only that bot's resource.

***

## Step by step

Click the button with your initials at the bottom of the sidebar, open **Configurações > Conta > Canais** (Settings > Account > Channels), choose **Microsoft Teams** and open the **Administração** (Administration) tab. Only organization administrators see this tab.

![Canais in the Conta section of Settings, with Slack and Microsoft Teams cards showing each account connection status](https://mintcdn.com/moradaai-f7bfc739/b0_HB7b5DqRbiPA9/images/morada-os/canais/canais-conta-lista.png?fit=max\&auto=format\&n=b0_HB7b5DqRbiPA9\&q=85\&s=81de25b5da2513d4b8f5845290f362ee)

The **Administração** tab shows five steps in order when the channel has not been installed yet. Keep that page open in a tab: you come back to it between steps.

> [!TIP]
>
> The numbers in the images match the steps on this page.

**1. Name the app**

In **Nome do app no Teams** (App name in Teams), write how the app will appear in Teams, up to 30 characters. By default, it is the assistant's name in Morada OS.

If the organization has more than one workspace in Morada OS, also choose **Onde ficam as conversas do Teams** (Where Teams conversations live): the workspace that receives the conversations of anyone who has not picked another one in their own preferences.

Click **Salvar e continuar** (Save and continue).

![The Microsoft Teams page at step 1, with the Nome do app no Teams field and the Salvar e continuar button marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/01-nome.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=f2b1ad0531b05aae2dc7e1efd07ca4e8)

**You see:** step 1 with a ✓ and the app's name and step 2 open.

**2. Register the bot in Azure**

> [tab] With one command (recommended)
>
> Morada OS generates a command you paste into **Azure Cloud Shell**, the terminal built into the Azure portal. The command creates the bot, the app registration and the client secret in your company's Azure, with your own account, and sends the values straight to Morada OS. Nothing is copied by hand.
>
> ![Step 2 of the Teams page with the Cloud Shell command, with the Copiar and Abrir o Cloud Shell buttons marked](https://mintcdn.com/moradaai-f7bfc739/QVsWaCG0CJ-wscmZ/images/morada-os/canais/teams/02-comando.png?fit=max\&auto=format\&n=QVsWaCG0CJ-wscmZ\&q=85\&s=5ab31738b514ad834237c4999939b1a6)
>
> 1. In step 2, click **Gerar o comando** (Generate the command) and then **Copiar** (Copy). The command is valid for 30 minutes and works once.
>
> 2. Click **Abrir o Cloud Shell** (Open Cloud Shell) and sign in with your Microsoft account. If Cloud Shell asks, choose **Bash**. The first time, it also asks about storage: choose **No storage account required**, select the subscription and click **Apply**.
>
> 3. Paste the command and press Enter. It shows the subscription and the directory it will use, by name and by ID, and everything it will create, including accepting the Microsoft Teams channel terms. Check it and answer `s` (yes).
>
>    > [!NOTE]
>    >
>    > If Cloud Shell shows, in yellow, **Subscription used to launch your CloudShell ... is not registered to Microsoft.CloudShell Namespace**, go ahead. The warning is about the subscription Cloud Shell itself runs in, not the one the command uses, and it does not stop the command.
>
> 4. **You see:** the command goes through six stages and ends with **Pronto** (Done). The Teams page in Morada OS moves on by itself: steps 2 and 3 get a ✓ and step 4 opens.
>
> > [!TIP]
> >
> > If you reload the page, it keeps following the command but does not show the command again. If you no longer have the command, click **Gerar outro comando** (Generate another command): the earlier one stops working.
>
> > [!NOTE]
> >
> > **Want to read the script before running it?** Click **Ver o que o comando faz** (See what the command does) in step 2: it opens the exact text the command runs. The client secret never shows on screen. It goes straight to Morada OS, which checks it with Microsoft and stores it encrypted.
>
> > [accordion] If the command stops
> >
> > | Message | What to do |
> > | - | - |
> > | **Sua conta não tem permissão nessa assinatura.** (Your account has no permission in this subscription.) | Ask for the **Contributor** role on the subscription and run the same command again. |
> > | **Sua conta não pode registrar aplicativos no Microsoft Entra.** (Your account cannot register apps in Microsoft Entra.) | Ask for the **Application Developer** role and run the same command again. |
> > | **O código de configuração venceu.** (The setup code expired.) | Click **Gerar outro comando** (Generate another command) in step 2 and run the new command. |
> > | **A Microsoft ainda não reconhece o aplicativo novo.** (Microsoft does not recognize the new app yet.) | Wait a few minutes and run the same command again. |
> >
> > Running the same command again picks up where it stopped: nothing is created twice. If you would rather undo, the command shows what it created and the commands to delete it.

> [tab] In the Azure portal
>
> In step 2, click **Prefiro registrar pelo portal do Azure** (I prefer to register in the Azure portal): two Morada OS addresses open, each with a **Copiar** (Copy) button. You paste each one in a different place in Azure.
>
> ![Step 2 of the Teams page with Prefiro registrar pelo portal do Azure open, and Abrir o portal do Azure, both Copiar buttons and Já registrei o bot marked](https://mintcdn.com/moradaai-f7bfc739/QVsWaCG0CJ-wscmZ/images/morada-os/canais/teams/02-registrar-bot.png?fit=max\&auto=format\&n=QVsWaCG0CJ-wscmZ\&q=85\&s=40a216b1cda9bc3b545e9dc27f6b8dde)
>
> 1. **Create the bot.** Click **Abrir o portal do Azure** (Open the Azure portal). In the portal, click **Create a resource**, search for `Azure Bot`, choose **Azure Bot** and click **Create**. On the **Basics** tab, fill in:
>
>    * **Bot handle**: a name of your own, with no spaces, like `aurora-teams-bot`.
>    * **Subscription** and **Resource group**. If you have no group, click **Create new**.
>    * **Pricing tier**: click **Change plan** and choose **F0**, the free one.
>    * **Type of App**: **Single Tenant**.
>    * **Creation type**: **Create new Microsoft App ID**.
>
>    Click **Review + create**, then **Create**. **You see:** the deployment finishes in a minute or two; click **Go to resource**.
>
>    ![Basics tab of Create an Azure Bot, with Change plan, Type of App Single Tenant, Create new Microsoft App ID and Review + create marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/02-azure-criar-bot.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=4d48136671d71338652a97024555118b)
>
> 2. **Paste the messaging endpoint.** In Morada OS, click **Copiar** next to **Ponto de extremidade de mensagens** (Messaging endpoint). In the bot, open **Settings**, **Configuration**, paste it into **Messaging endpoint** and click **Apply**.
>
>    ![The Azure Bot Configuration page, with the Messaging endpoint field, the Channels menu item and the Manage Password link marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/02-azure-configuracao.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=e14d519fea98cb96292704369d66f688)
>
> 3. **Turn on Teams.** In the bot's menu, open **Channels**. Under **Available Channels**, click **Microsoft Teams**, accept the terms and click **Apply**. **You see:** **Microsoft Teams** in the list of channels connected to the bot.
>
> 4. **Add the redirect URI.** Still in **Configuration**, click **Manage Password** next to **Microsoft App ID**. It opens the bot's app registration in Microsoft Entra, with its menu on the left. In **Authentication**, click **Add a platform** and choose **Web**. In Morada OS, click **Copiar** next to **URI de redirecionamento** (Redirect URI), paste it into **Redirect URIs** and click **Configure**. This address is how each person connects their Teams account with **Conectar minha conta** (Connect my account).
>
> 5. **Create a client secret.** In the same app registration, open **Certificates & secrets**, the **Client secrets** tab, and click **New client secret**. Give it a description, choose how long it lasts and click **Add**.
>
>    **Copy the Value column right away**, not the **Secret ID** column: Azure shows the value only now. You paste that value in step 3.
>
> 6. Back in Morada OS, click **Já registrei o bot** (I registered the bot). **You see:** step 2 with a ✓ and step 3 open.
>
> > [!WARNING]
> >
> > The secret's value is the bot's password. Paste it only in Morada OS; never send it by email or chat.
>
> > [!TIP]
> >
> > Write down when the secret expires. Before that, create a new secret in Azure and paste its value in **Trocar o segredo do cliente** (Change the client secret), on the Teams page.

**3. Azure credentials**

> [tab] With one command (recommended)
>
> There is nothing to copy: the command in step 2 already sent the credentials to Morada OS, and Microsoft accepted them.
>
> **You see:** step 3 with a ✓, the title **Credenciais do Azure** (Azure credentials) and **O comando enviou as credenciais do aplicativo** (The command sent the application's credentials) followed by the ID and the date the client secret expires. Go on to step 4.
>
> > [!TIP]
> >
> > Before that date, generate the command again in **Reparar o bot no Azure** (Repair the bot in Azure), in the **Administração** tab: it replaces the client secret without changing the app.

> [tab] In the Azure portal
>
> In the bot's app registration, open **Overview** and copy into Morada OS:
>
> | In Azure | In Morada OS |
> | - | - |
> | **Application (client) ID** | **ID do aplicativo (cliente)** |
> | **Directory (tenant) ID** | **ID do diretório (locatário)** |
> | The secret value you copied in step 2 | **Valor do segredo do cliente** (Client secret value) |
>
> Click **Salvar credenciais** (Save credentials).
>
> ![Step 3 of the Teams page, with the ID do aplicativo (cliente), ID do diretório (locatário) and Valor do segredo do cliente fields filled with sample values and the Salvar credenciais button marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/03-valores.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=a325e2ec3cc2707d1694e6006e1708ca)
>
> **You see:** the button reads **Conferindo com a Microsoft...** (Checking with Microsoft) and then step 3 shows a ✓, the title **Credenciais do Azure** (Azure credentials) and **Credenciais conferidas para o ID do aplicativo** (Credentials checked for the application ID) followed by the ID.
>
> Before saving, Morada OS checks the three values with Microsoft. If Microsoft refuses them, nothing is saved and the step says why:
>
> ![Step 3 with the notice that the directory (tenant) ID was not found at Microsoft](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/03-recusa.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=f8f0238c0880230f29fff1b41c450ee7)
>
> | Notice | What to do |
> | - | - |
> | **O ID do aplicativo (cliente) não foi encontrado nesse ID do diretório (locatário).** (The application (client) ID was not found in that directory (tenant) ID.) | Copy both from the **Overview** of the same app registration. |
> | **A Microsoft não aceitou o segredo do cliente.** (Microsoft did not accept the client secret.) | Copy the **Value** column, not the **Secret ID**, and check that the secret has not expired. If the value no longer shows, create a new secret. |
> | **Esse ID do diretório (locatário) não foi encontrado na Microsoft.** (That directory (tenant) ID was not found at Microsoft.) | Copy the **Directory (tenant) ID** from the **Overview** of the bot's app registration. |
> | **A Microsoft confirmou as credenciais para outro aplicativo ou outro diretório.** (Microsoft confirmed the credentials for another application or directory.) | The two IDs come from different registrations. Copy both from the same one. |
> | **A Microsoft recusou essas credenciais.** (Microsoft refused these credentials.) | Check the three values in the app registration and try again. |
> | **Esse ID do diretório (locatário) já está em uso pelo Morada OS de outra organização.** (That directory (tenant) ID is already used by another organization's Morada OS.) | Each Microsoft organization is linked to one Morada OS organization only. Check that it is your organization's, or contact Morada support. |
> | **Não foi possível falar com a Microsoft para conferir as credenciais, e nada foi salvo.** (Could not reach Microsoft to check the credentials, and nothing was saved.) | Try again in a few minutes. |
>
> The secret's value is stored encrypted and is not shown on screen again.

**4. Send the package to Teams**

The **package** is the app's file for Teams: it carries the name, the organization's icon and the bot's application ID.

![Step 4 of the Teams page, with the Baixar o pacote, Abrir o centro de administração do Teams and Já enviei o pacote buttons and the Link do app no Teams (opcional) field marked](https://mintcdn.com/moradaai-f7bfc739/mgukosaoxjfZ34ct/images/morada-os/canais/teams/04-pacote.png?fit=max\&auto=format\&n=mgukosaoxjfZ34ct\&q=85\&s=d330f68f6375933e4ec5fc1769050e65)

1. Click **Baixar o pacote** (Download the package). **You see:** a `.zip` file in your downloads folder. Do not open or unzip it.

2. Click **Abrir o centro de administração do Teams** (Open the Teams admin center) and sign in with a Teams administrator account. In **Teams apps**, **Manage apps**, click **Actions** and **Upload new app**. On some screens, **Upload new app** shows directly, without the **Actions** menu.

   ![The Actions menu open in Manage apps, with Upload new app marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/04-admin-carregar.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=4a53bdf28b6c5bfae1a8846fd42efa51)

3. Click **Upload** and choose the `.zip` you downloaded. **You see:** the **New app added** window. Click **this link** to open the app's page.

   ![The New app added window, with this link marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/04-admin-adicionado.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=100e04a9993ab01ddc19fce1790d6df7)

4. **Choose who can use it.** On the app's page, open the **Users and groups** tab and click **Edit availability**. In **Available to**, choose everyone, specific users or groups, or no one, and click **Apply**.

   ![The app's page in the Teams admin center, with the Users and groups tab and the Edit availability button marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/04-admin-usuarios-grupos.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=322b558e883cc1f87a55a78917673776)

   ![The Edit availability panel, with the Available to field marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/04-admin-disponibilidade.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=b8dc00ea27318e17bf1751aa28992438)

   Guests from other companies do not use the app, even if they are on the list.

5. Back in Morada OS, click **Já enviei o pacote** (I sent the package). **You see:** step 4 with a ✓ and step 5 open. If you reload the page, step 4 stays done.

6. **Optional: paste the app link.** In Teams, open **Apps**, find the app, click **Share** and copy the link. In step 4 of Morada OS, paste it in **Link do app no Teams (opcional)** (App link in Teams, optional) and click **Salvar o link** (Save the link). With it, Morada OS shows **Abrir no Teams** (Open in Teams) to everyone, including people who have not added the app yet, and that button goes straight to the app's page in Teams. If the app does not show for you in Teams yet, paste the link later: the field stays in step 5 and, after the install, sits in the **Administração** tab under **Link do app no Teams**. You can also ask in the Morada OS chat: *"save this Teams app link"*, with the link in the same message.

> [!NOTE]
>
> Teams can take a few hours to show a new app to people. An availability change takes up to 24 hours and, in rare cases, up to six days. Sending the package from Teams itself, outside the admin center, only works if the organization's policy allows uploading custom apps.

**5. Send the app a message in Teams**

1. In step 5, click **Abrir no Teams** (Open in Teams), if you saved the app link in step 4. Without the link, open Teams, go to **Apps** and search for the app by name.

2. Click **Add**. **You see:** **Added successfully!**. Click **Open** and send any message in the chat with the app. After adding it, **Abrir a conversa no Teams** (Open the chat in Teams), in step 5, also goes straight to that chat.

   ![The Teams window after adding the app, with the Open button and the channel list marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/05-teams-adicionado.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=9a37e0ec3cc1f40aad4287a0ac377c9a)

3. Go back to Morada OS. You do not need to click anything: step 5 shows **Esperando o Teams avisar o Morada OS.** (Waiting for Teams to tell Morada OS) and moves on by itself when Teams reports the app was added.

   ![Step 5 of the Teams page, with the Abrir no Teams and Abrir a conversa no Teams buttons and the Esperando o Teams avisar o Morada OS notice](https://mintcdn.com/moradaai-f7bfc739/mgukosaoxjfZ34ct/images/morada-os/canais/teams/05-mensagem.png?fit=max\&auto=format\&n=mgukosaoxjfZ34ct\&q=85\&s=5a21ff6096f6276255f1b911419fb26e)

> [!WARNING]
>
> A new app can take a few hours to show up in Teams and to answer, up to 24 hours. Teams releases the app to each person on its own schedule: it may answer some colleagues within a few hours and another person, even the one who sent the package, only much later, with nothing to change in Morada OS or in Teams. Meanwhile, the Teams store may show **Request approval** instead of **Add**: do not click it, because it sends a request to the administrators. Wait and try again later.

**You see:** the app's health in the **Administração** tab instead of the steps (see [Check that everything is fine](#check-that-everything-is-fine)). If Teams already reported the app was added but no message has arrived yet, the page shows **O Teams avisou que o app foi adicionado.** (Teams reported the app was added) with the same buttons. In Teams, the app shows a **Conectar minha conta** button that opens the **Microsoft Teams** page in **Canais**.

> [accordion] Install the app for everyone at once
>
> Instead of each person adding the app, you can install it for everyone, or for the people and groups you choose, from the Teams admin center:
>
> 1. In **Teams apps**, **Manage apps**, open the app's page.
> 2. Open the **Users and groups** tab, then **Installs**, and click **Install app**.
> 3. Choose who to install it for and click **Apply**. The app also becomes available to those people, with no other step.
>
> The install can also take hours to show up in each person's Teams.

### After installing: tell your team

* **Each person connects their own Teams account, once, before the app answers them.** It is in **Configurações > Conta > Canais > Microsoft Teams** (Settings > Account > Channels > Microsoft Teams), with **Conectar minha conta** (Connect my account). Until then, the app does not use the AI or spend credits: it only shows the person a card with a **Conectar minha conta** button that opens the **Microsoft Teams** page in **Canais**. That goes for you too.

  ![Microsoft Teams page with the Conectar minha conta button marked](https://mintcdn.com/moradaai-f7bfc739/b0_HB7b5DqRbiPA9/images/morada-os/canais/teams-conectar-conta.png?fit=max\&auto=format\&n=b0_HB7b5DqRbiPA9\&q=85\&s=5353aa05d0b9e2097b84735f31e7eede)

* **The app recognizes each person by their Microsoft account's email.** Whoever is going to use it needs a Morada OS account with that same email. Invite anyone who does not have one yet.

* **To use it in a channel, someone adds the app to the team.** In Teams, in **Apps**, open the app, pick a channel under **Select a channel** and confirm. When adding it, Teams shows what the app can do, including reading the messages in the team's channels: the app only reads the conversation where it is mentioned.

* **In a private channel, the app joins channel by channel.** The first time someone mentions the app in a private channel, Teams asks whether to add the app to the channel. Click **Add**. Each private channel asks once.

  ![The Teams window in a private channel, asking whether to add the app to the channel, with the Add button marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/canal-privado.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=7a28eeb1988e90425cf56995ff9bdec1)

* **Channels shared with other companies are not served yet.**

Send your team the page [Use Morada OS in Teams](https://docs.morada.ai/morada-os/en/channels/teams.md): it explains how to connect, talk and approve.

***

## Check that everything is fine

After the installation, the **Administração** (Administration) tab of the **Microsoft Teams** page, in **Canais**, shows the app's health:

![The Microsoft Teams page with the Ativo badge and the Eventos, Último erro, Onde está, Pessoas, Nome do app and Bot rows](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/saude.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=89391774da0175cfbefad35841f6ed3d)

| Row | What it shows |
| - | - |
| **Eventos** (Events) | When the last message from Teams arrived. If none arrived in the last 7 days, send the app a message in Teams to test it. |
| **Último erro** (Last error) | The last error in the last 7 days, and when it happened. |
| **Onde está** (Where it is) | How many teams and chats the app was added to. |
| **Pessoas** (People) | How many people have connected their Teams account. |
| **Nome do app** (App name) | The app's name. |
| **Conversas do Teams** (Teams conversations) | The default workspace for conversations, when the organization has more than one. |
| **Bot** | The application (client) ID and the directory (tenant) ID saved in Morada OS. |

For organization administrators, the **Instalação da organização** (Organization installation) badge on the card in **Canais** sums up the situation:

| Badge | What it means |
| - | - |
| **Em configuração** (Setting up) | Steps are missing, or Teams has not told Morada OS yet. |
| **Falta adicionar no Teams** (Not added in Teams yet) | The app is installed, but it is in no team or chat right now. |
| **Ativo** (Active) | All good. |
| **Precisa de atenção** (Needs attention) | The app package changed: see the section below. |
| **Sem acesso** (No access) | Morada OS cannot sign in as the bot. See [When something goes wrong](#when-something-goes-wrong). |

Below the table are **Nome** (Name) (or **Nome e workspace**, Name and workspace), **Endereços do bot** (Bot addresses), **Pacote do app** (App package), **Link do app no Teams** (App link in Teams) and **Trocar o segredo do cliente** (Change the client secret). If you change the app's name, download the package again and send it to Teams.

> [!TIP]
>
> You can also ask in the Morada OS chat: *"is Teams installed? is everything fine with it?"*. The assistant reads the same situation the page shows and says what to do.

***

## When Morada OS asks for a new package

To use the app in group chats, keep the package up to date. When the **Administração** (Administration) tab shows a newer package, download it and upload it again in the Teams admin center, following the steps below.

When Morada OS starts needing something new from Teams, the page shows **O pacote do app mudou.** (The app package changed.) and the card in **Canais** shows **Precisa de atenção** (Needs attention) for organization administrators.

![The O pacote do app mudou notice, with the Baixar o pacote and Já enviei o pacote buttons marked](https://mintcdn.com/moradaai-f7bfc739/_8tOjfT8Z9GnT5Ak/images/morada-os/canais/teams/pacote-mudou.png?fit=max\&auto=format\&n=_8tOjfT8Z9GnT5Ak\&q=85\&s=dfbf0a568a55c7714e21e529f594419d)

**1. Download the new package**

Click **Baixar o pacote**, in the notice.

**2. Send it as a new version**

In the Teams admin center, in **Manage apps**, open the app and click **Upload file**, under **New version**, on its page. People who already use the app keep it, and the availability you chose still applies.

**3. Tell Morada OS**

Back in the **Administração** tab of **Microsoft Teams**, in **Canais**, click **Já enviei o pacote**. **You see:** the notice goes away and the installation returns to **Ativo** (Active) on the card in **Canais**.

***

## Recreate a bot deleted from Azure

![Administração tab on the Teams page, with Reparar o bot no Azure marked](https://mintcdn.com/moradaai-f7bfc739/b0_HB7b5DqRbiPA9/images/morada-os/canais/teams-administracao.png?fit=max\&auto=format\&n=b0_HB7b5DqRbiPA9\&q=85\&s=62a0e35f35980537ed9f46f0fe560772)

If the Azure Bot or its resource group was deleted, open **Configurações > Conta > Canais > Microsoft Teams > Administração** (Settings > Account > Channels > Microsoft Teams > Administration) in Morada OS and, under **Reparar o bot no Azure** (Repair the bot in Azure), click **Gerar o comando** (Generate the command). Run the command in Azure Cloud Shell, in Bash mode, using an account that owns the app registration and the subscription where the bot should live.

The command keeps the installation's existing application ID and tenant. It recreates the resource group, Azure Bot and Microsoft Teams channel when they are missing. It also creates a new secret, and removes previous secrets created by Morada OS only after the OS verifies and stores the new one. Other applications' secrets are not removed.

The command expires after 30 minutes and works once. Generating another command invalidates the previous one. When it finishes, send the app a message in Teams to check its reply.

If your account does not own the app registration, ask an existing owner to run the command or add you as an owner. If the app registration itself was deleted, [remove Teams](#remove-teams) and install it again.

***

## Remove Teams

To take the Teams app out of your organization, for example to install it again from a clean start, open **Configurações > Conta > Canais > Microsoft Teams > Administração** (Settings > Account > Channels > Microsoft Teams > Administration) in Morada OS, open **Remover o Teams** (Remove Teams) and click **Remover o Teams da organização** (Remove Teams from the organization). Morada OS asks you to confirm before it removes anything.

When you confirm:

* The app stops answering in Teams for everyone in the organization.
* Morada OS deletes the credentials it kept for the app.
* The conversations stay in Morada OS.
* To use Teams again, an organization admin makes a new installation, and each person connects their account again.

### What is left to delete outside Morada OS

Morada OS has no access to your company's Azure or Teams admin center. After the removal, the **Administração** tab shows what is left, with the installation's IDs filled in. The notice stays on the page until someone starts a new installation.

**1. Delete the bot and the app registration in Azure**

Copy the command from the page and run it in Azure Cloud Shell, in Bash mode, with an account in the installation's tenant and in the subscription where the bot is.

The command deletes only what the setup command created for this installation:

* the installation's Azure Bot, when it uses the installation's application;
* the app registration the setup command created, with its service principal;
* the bot's resource group, when it is empty and the setup command created it.

The command does not delete:

* an Azure Bot that uses another application;
* an app registration created by hand in the Azure portal (the command shows the link so you can delete it there);
* a resource group that still holds other resources or that the setup command did not create;
* anything in Teams.

Before deleting, the command shows what it will delete and what it will keep, and asks you to confirm. If it stops halfway, run the same command again: it deletes only what still exists. The deleted app registration stays in **Deleted applications** in Microsoft Entra for 30 days and can be restored in that time.

If you registered the bot in the Azure portal, without the command, delete the Azure Bot and the app registration in the portal.

**2. Delete the app in Teams**

In the Teams admin center, open the app's page and choose **More commands (…) > Actions > Delete**. The Morada OS page has a direct link when it knows the app; otherwise, find the app under **Teams apps > Manage apps**.

Teams can keep showing the app for a few hours after it is deleted.

***

## When something goes wrong

> [accordion] O app do Teams está sem acesso. (The Teams app has no access.)
>
> Morada OS can no longer sign in to Microsoft as the bot, which happens, for example, when the client secret expires or is deleted in Azure. Nobody gets answers in Teams until you fix it. Create a new secret in **Certificates & secrets**, in the bot's app registration, and paste the value in **Trocar o segredo do cliente**, on the Teams page.

> [accordion] O Teams recusou uma resposta do app. (Teams refused a reply from the app.)
>
> Check that the app is still added to the team or chat and that the package sent to the Teams admin center is the latest one.

> [accordion] Nobody can find the app in Teams.
>
> A new app can take a few hours to show up, and an availability change takes up to 24 hours (in rare cases, up to six days). Check, in the Teams admin center, that the app is on the **Manage apps** list and that its availability includes the people looking for it. If the Teams store shows **Request approval**, do not click it: wait for Teams to release the app.

> [accordion] The page does not get past step 5.
>
> Teams has not told Morada OS yet, and with a new app that can take a few hours, up to 24 hours, and the time varies from one person to another. Check that the bot's **Messaging endpoint**, in Azure, matches the one in Morada OS (in **Ver os endereços do bot**, See the bot's addresses, at step 2), that the **Microsoft Teams** channel is connected to the bot, and that someone has already added the app in Teams. The page moves on by itself when the notice arrives.

> [accordion] Someone wrote to the app and it did not answer.
>
> The chat with the app can show up in someone's list only because the app was added to a team. What the person writes there does not reach the app until they add it for personal use: Teams shows a banner at the top of the chat with an **Add app** button (**Adicionar aplicação** in Portuguese). Ask them to click it and send the message again. With a new app, Teams may also not have released the app to that person yet: wait up to 24 hours.

> [accordion] A person cannot connect their Teams account.
>
> The **Microsoft Teams** page, in **Canais**, says why. If it is **A Microsoft não concluiu a conexão.** (Microsoft did not complete the connection.), check that the Morada OS **URI de redirecionamento** is registered on the **Web** platform, in **Authentication**, in the bot's app registration. The other reasons are in [Connect your account](https://docs.morada.ai/morada-os/en/channels/teams.md#connect-your-account-just-once).

> [accordion] Could not download the package.
>
> The notice says why. If it is the organization's icon, upload the icon again in **Configurações**, **Identidade**, and download the package again.

> [accordion] Someone mentioned the app in a channel and it did not answer.
>
> Check that the app was added to the channel's team, that the person connected their account, and that the channel is not shared: the app does not answer in shared channels yet. In a private channel, the app needs to be added to that channel itself: Teams asks about it on the first mention.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.