> ## Documentation Index
> Fetch the complete documentation index at: https://portkey-docs-mintlify-enhance-budget-policies-param-docs-45.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Virtual Key

#### <Icon icon="microsoft" /> Azure OpenAI

Create virtual key to access your Azure OpenAI models or deployments, and manage all auth in one place.

<AccordionGroup>
  <Accordion title="Default Auth" icon="key">
    <CodeGroup>
      ```py Python theme={null}
      from portkey_ai import Portkey

      client = Portkey(
          api_key="<api_key>"
      )

      virtual_key = client.virtual_keys.create(
          name="Azure-Virtual-Default",
          provider="azure-openai",
          note="Azure Note",
          key="<api_key>",
          resourceName="<resource_name>",
          deploymentConfig=[
              {
                  "apiVersion": "2024-08-01-preview",
                  "deploymentName": "DeploymentName",
                  "is_default": True,
              },
              {
                  "apiVersion": "2024-08-01-preview",
                  "deploymentName": "DeploymentNam2e",
                  "is_default": False,
              },
          ],
      )

      print(virtual_key)
      ```

      ```ts JavaScript theme={null}
      import Portkey from 'portkey-ai';

      const portkey = new Portkey({
        apiKey: 'PORTKEY_API_KEY'
      });

      async function main() {
        const key = await client.virtualKeys.create({
          name: "Azure-Virtual-Default",
          provider: "azure-openai",
          note: "Azure Note",
          key: "<api_key>",
          resourceName: "<resource_name>",
          deploymentConfig: [
              {
                  "apiVersion": "2024-08-01-preview",
                  "deploymentName": "DeploymentName",
                  "is_default": True,
              },
              {
                  "apiVersion": "2024-08-01-preview",
                  "deploymentName": "DeploymentNam2e",
                  "is_default": False,
              }
          ]
        });

        console.log(key);
      }

      main();
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Azure Entra ID" icon="user">
    <CodeGroup>
      ```py Python theme={null}
      from portkey_ai import Portkey

      client = Portkey(
          api_key="<api_key>"
      )

      virtual_key = client.virtual_keys.create(
          name="Azure-Virtual-entra",
          provider="azure-openai",
          note="azure entra",
          resourceName="<resource_name>",
          deploymentConfig=[
              {
                  "deploymentName": "<deployment_name>",
                  "is_default": True,
                  "apiVersion": "2024-08-01-preview",
              }
          ],
          azureAuthMode="entra",
          azureEntraClientId="<client_id>",
          azureEntraClientSecret="<client_secret>",
          azureEntraTenantId="<tenantId>",
      )

      print(virtual_key)
      ```

      ```ts JavaScript theme={null}
      import Portkey from 'portkey-ai';

      const portkey = new Portkey({
        apiKey: 'PORTKEY_API_KEY'
      });

      async function main() {
        const key = await client.virtualKeys.create({
          name: "Azure-Virtual-entra",
          provider: "azure-openai",
          note: "azure entra",
          resourceName: "<resource_name>",
          deploymentConfig: [
              {
                  "deploymentName": "<deployment_name>",
                  "is_default": True,
                  "apiVersion": "2024-08-01-preview",
              }
          ],
          azureAuthMode: "entra",
          azureEntraClientId: "<client_id>",
          azureEntraClientSecret: "<client_secret>",
          azureEntraTenantId: "<tenantId>"
        });

        console.log(key);
      }

      main();
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Azure Managed Identity" icon="user-lock">
    <CodeGroup>
      ```py Python theme={null}
      from portkey_ai import Portkey

      client = Portkey(
          api_key="<api_key>",
      )

      virtual_key = client.virtual_keys.create(
          name="Azure-Virtual-entra",
          provider="azure-openai",
          note="azure entra",
          resourceName="<resource_name>",
          deploymentConfig=[
              {
                  "deploymentName": "<deployment_name>",
                  "is_default": True,
                  "apiVersion": "2024-08-01-preview",
              }
          ],
          azureAuthMode="managed",
          azureManagedClientId="<client-id>" # optional
      )

      print(virtual_key)
      ```

      ```ts JavaScript theme={null}
      import Portkey from 'portkey-ai';

      const portkey = new Portkey({
        apiKey: 'PORTKEY_API_KEY'
      });

      async function main() {
        const key = await client.virtualKeys.create({
          name="Azure-Virtual-entra",
          provider="azure-openai",
          note="azure entra",
          resourceName="<resource_name>",
          deploymentConfig=[
              {
                  "deploymentName": "<deployment_name>",
                  "is_default": True,
                  "apiVersion": "2024-08-01-preview",
              }
          ],
          azureAuthMode="managed",
          azureManagedClientId="<client-id>" # optional
        });

        console.log(key);
      }

      main();
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

#### <Icon icon="aws" /> AWS Bedrock

Create virtual key to access your AWS Bedrock models or deployments, and manage all auth in one place.

<Accordion icon="user-plus" title="AWS Assumed Role">
  <CodeGroup>
    ```py Python theme={null}
    from portkey_ai import Portkey

    client = Portkey(
        api_key="<api_key>",
    )

    virtual_key = client.virtual_keys.create(
        name="bedrock-assumed",
        provider="bedrock",
        note="bedrock",
        awsRegion="<region>",
        awsAuthType="assumedRole",
        awsRoleArn="arn:aws:iam::<account_id>:role/<role_name>",
        awsExternalId="<external_id>",
    )

    print(virtual_key)
    ```

    ```ts JavaScript theme={null}
    import Portkey from 'portkey-ai';

    const portkey = new Portkey({
      apiKey: 'PORTKEY_API_KEY'
    });

    async function main() {
      const key = await client.virtualKeys.create({
        name: "bedrock-assumed",
        provider: "bedrock",
        note: "bedrock",
        awsRegion: "<region>",
        awsAuthType: "assumedRole",
        awsRoleArn: "arn:aws:iam::<account_id>:role/<role_name>",
        awsExternalId: "<external_id>"
      });

      console.log(key);
    }

    main();
    ```
  </CodeGroup>
</Accordion>

#### <Icon icon="google" /> Vertex AI

Create virtual key to access any models available or hosted on Vertex AI. [Docs →](/integrations/llms/vertex-ai)

<Card icon="gear" title="Learn More About Virtual Keys" href="/product/ai-gateway/virtual-keys">
  Securely store your provider auth in Portkey vault and democratize and streamline access to Gen AI.
</Card>
