# Microsoft Azure (/en/ai/platform/models/asr/microsoft)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

> Documentation: Conversational AI.
> Documentation version: Preview.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt).


Microsoft Azure provides enterprise-grade automatic speech recognition with support for multiple languages and robust noise handling capabilities, optimized for real-time conversational applications.

## Sample configuration

The following example shows how to configure Microsoft Azure as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent).

Microsoft Azure supports BYOK only. It isn't available in managed mode. Store your Azure Speech key in a secret set, and refer to it from the agent. Your Azure region isn't secret. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys).

**Python SDK**

```python
from agora_agent import Agent, MicrosoftSTT, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(
        MicrosoftSTT(
            key=secret_ref("support_prod", "microsoft"),
            region="eastus",
            language="en-US",
            additional_params={"phrase_list": ["agora", "conversational", "ai", "engine"]},
        )
    )
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure your TTS vendor
)
```

**TypeScript SDK**

```ts
import { Agent, MicrosoftSTT, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(
    new MicrosoftSTT({
      key: secretRef('support_prod', 'microsoft'),
      region: 'eastus',
      language: 'en-US',
      additionalParams: { phrase_list: ['agora', 'conversational', 'ai', 'engine'] },
    }),
  )
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure your TTS vendor */);
```

**Go SDK**

```go
// client is your configured Agora client
agent := agentkit.NewAgent(client).
	WithStt(vendors.NewMicrosoftSTT(vendors.MicrosoftSTTOptions{
		Key:      agentkit.SecretRef("support_prod", "microsoft"),
		Region:   "eastus",
		Language: "en-US",
		AdditionalParams: map[string]interface{}{
			"phrase_list": []string{"agora", "conversational", "ai", "engine"},
		},
	})).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts( /* configure your TTS vendor */ )
```

**REST API**

Set `credential.mode` to `byok` and `credential.fields.key` to a reference to your Azure Speech key in a secret set. Pass the region in `params`. In the following example, the key is stored as `microsoft` in the `support_prod` set:

```json
"asr": {
  "credential": {
    "mode": "byok",
    "fields": {
      "key": "$secrets.support_prod.microsoft"
    }
  },
  "vendor": "microsoft",
  "language": "en-US",
  "params": {
    "language": "en-US",
    "region": "eastus",
    "phrase_list": ["agora", "conversational", "ai", "engine"]
  }
}
```

## Key parameters

The `asr` block takes the following fields. In the SDKs, `MicrosoftSTT` sets them from its options, and passes any other Microsoft Azure parameters from its additional parameters option to `params`.

**asr required**

**`vendor` (string) required**

Set to `microsoft`.

**`credential` (object) required**

How the agent authenticates with Microsoft Azure. Set `mode` to `byok` and `fields.key` to a `$secrets.<set>.<key>` reference to your Azure Speech key. Get your key from the [Azure Portal](https://portal.azure.com/).

**`language` (string) required**

The language code for speech recognition, for example, `en-US`, `es-ES`, or `fr-FR`. See [supported languages](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt) for language codes.

**`params` (object) required**

**`region` (string) required**

The Azure region where the speech service is hosted, for example, `eastus` or `westus2`.

**`phrase_list` (array[string]) optional**

A list of words or phrases provided in advance to improve recognition accuracy.

> **Caution**
>
> The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Microsoft Azure without validation. For a full list of supported options, refer to the [Microsoft Azure Speech-to-Text documentation](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/speech-to-text).
