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

# Azure

## Example

<CodeGroup>
  ```python agent.py theme={null}
  import os
  from typing import Iterator

  from phi.agent import Agent, RunResponse
  from phi.model.azure import AzureOpenAIChat

  azure_model = AzureOpenAIChat(
      id=os.getenv("AZURE_OPENAI_MODEL_NAME"),
      api_key=os.getenv("AZURE_OPENAI_API_KEY"),
      azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
      azure_deployment=os.getenv("AZURE_OPENAI_DEPLOYMENT"),
  )

  agent = Agent(
      model=azure_model,
  )

  # Get the response in a variable
  # run: RunResponse = agent.run("Share a 2 sentence horror story.")
  # print(run.content)

  # Print the response on the terminal
  agent.print_response("Share a 2 sentence horror story.")
  ```
</CodeGroup>

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install libraries">
    ```bash theme={null}
    pip install -U openai phidata
    ```
  </Step>

  <Step title="Export Environment Variables">
    ```bash theme={null}
      export AZURE_OPENAI_API_KEY=***
      export AZURE_OPENAI_ENDPOINT=***
      export AZURE_OPENAI_MODEL_NAME=***
      export AZURE_OPENAI_DEPLOYMENT=***
      # Optional:
      # export AZURE_OPENAI_API_VERSION=***
    ```
  </Step>

  <Step title="Run azure Agent">
    ```bash theme={null}
    python cookbook/providers/azure_openai/basic.py
    ```
  </Step>
</Steps>

## Information

* View on [Github](https://github.com/agno-agi/phidata/tree/main/cookbook/providers/azure_openai/basic.py)
