Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Build Status

Azure Mixed Reality Authentication Package client library for Python

Deprecation notice

This package has been deprecated and will no longer be maintained after 10-01-2025. This package will only receive security fixes until 10-01-2025.

Overview

Mixed Reality services, like Azure Remote Rendering use the Mixed Reality security token service (STS) for authentication. This package supports exchanging Mixed Reality account credentials for an access token from the STS that can be used to access Mixed Reality services.

Getting started

Currently supported environments

This package has been tested with Python 3.7+.

Prerequisites

Install the package

Install the Azure Mixed Reality Authentication SDK.

pip install --pre azure-mixedreality-authentication

Create and authenticate the client

To create a client object to request an access token for a Mixed Reality service, you will need the account identifier and account domain of your Mixed Reality service resource and a credential.

Mixed Reality services support a few different forms of authentication:

  • Account Key authentication
    • Account keys enable you to get started quickly with using Mixed Reality services. But before you deploy your application to production, we recommend that you update your app to use Azure AD authentication.
  • Azure Active Directory (AD) token authentication
    • If you're building an enterprise application and your company is using Azure AD as its identity system, you can use user-based Azure AD authentication in your app. You then grant access to your Mixed Reality accounts by using your existing Azure AD security groups. You can also grant access directly to users in your organization.
    • Otherwise, we recommend that you obtain Azure AD tokens from a web service that supports your app. We recommend this method for production applications because it allows you to avoid embedding the credentials for access to a Mixed Reality service in your client application.

See [here][register_aad_app] for detailed instructions and information.

Using account key authentication

Use the Azure Portal to browse to your Mixed Reality service resource and retrieve an account key.

Once you have an account key, you can use the AzureKeyCredential class to authenticate the client as follows:

from azure.core.credentials import AzureKeyCredential
from azure.mixedreality.authentication import MixedRealityStsClient

account_id = "<ACCOUNT_ID>"
account_domain = "<ACCOUNT_DOMAIN>"
account_key = "<ACCOUNT_KEY>"
key_credential = AzureKeyCredential(account_key)

client = MixedRealityStsClient(account_id, account_domain, key_credential)

Note: Account key authentication is not recommended for production applications.

Using an Azure Active Directory Credential

Account key authentication is used in most of the examples, but you can also authenticate with Azure Active Directory using the Azure Identity library. This is the recommended method for production applications. To use the DefaultAzureCredential provider shown below, or other credential providers provided with the Azure SDK, please install the @azure/identity package:

You will also need to [register a new AAD application][register_aad_app] and grant access to your Mixed Reality resource by assigning the appropriate role for your Mixed Reality service to your service principal.

from azure.identity import DefaultAzureCredential
from azure.mixedreality.authentication import MixedRealityStsClient

account_id = "<ACCOUNT_ID>"
account_domain = "<ACCOUNT_DOMAIN>"
default_credential = DefaultAzureCredential()

client = MixedRealityStsClient(account_id, account_domain, default_credential)

Key concepts

MixedRealityStsClient

The MixedRealityStsClient is the client library used to access the Mixed Reality STS to get an access token. An access token can be retrieved by calling get_token() on an MixedRealityStsClient instance.

Tokens obtained from the Mixed Reality STS have a lifetime of 24 hours.

Token result value

The return value for a successful call to get_token is an azure.core.credentials.AccessToken.

See the authentication examples above or Azure Identity for more complex authentication scenarios.

Retrieve an access token synchronously

from azure.core.credentials import AzureKeyCredential
from azure.mixedreality.authentication import MixedRealityStsClient

account_id = "<ACCOUNT_ID>"
account_domain = "<ACCOUNT_DOMAIN>"
account_key = "<ACCOUNT_KEY>"
key_credential = AzureKeyCredential(account_key)

client = MixedRealityStsClient(account_id, account_domain, key_credential)

token = client.get_token()

Retrieve an access token asynchronously

from azure.core.credentials import AzureKeyCredential
from azure.mixedreality.authentication.aio import MixedRealityStsClient

account_id = "<ACCOUNT_ID>"
account_domain = "<ACCOUNT_DOMAIN>"
account_key = "<ACCOUNT_KEY>"
key_credential = AzureKeyCredential(account_key)

client = MixedRealityStsClient(account_id, account_domain, key_credential)

token = await client.get_token()

Examples

These are code samples that show common scenario operations with the Azure Mixed Reality Authentication client library. The async versions of the samples (the python sample files appended with _async) show asynchronous operations, and require Python 3.5 or later. Before running the sample code, refer to Prerequisites

to create a resource, then set some Environment Variables

set MIXEDREALITY_ACCOUNT_DOMAIN="<the Mixed Reality account domain>"
set MIXEDREALITY_ACCOUNT_ID="<the Mixed Reality account identifier>"
set MIXEDREALITY_ACCOUNT_KEY="<the Mixed Reality account primary or secondary key>"

pip install azure-mixedreality-authentication

python samples\client_sample.py
python samples\client_sample_async.py

Troubleshooting

The troubleshooting section for Azure Identity can be helpful when troubleshooting authentication issues.

Next steps

Mixed Reality client libraries

  • Coming soon

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.

Release History

1.0.0b2 (2026-02-12)

Other Changes

  • Python 2.7 is no longer supported. Please use Python version 3.7 or later.
  • This package has been deprecated and will no longer be maintained after 10-01-2025. This package will only receive security fixes until 10-01-2025.

1.0.0b1 (2021-11-12)

Features Added

  • Initial release with support for authenticating with Mixed Reality services.

Metadata

Release files for azure-mixedreality-authentication 1.0.0b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azure-mixedreality-authentication 1.0.0b2
File Size Uploaded Provenance
azure_mixedreality_authentication-1.0.0b2.tar.gz 21.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for azure-mixedreality-authentication 1.0.0b2
File Interpreter ABI Platform
azure_mixedreality_authentication-1.0.0b2-py3-none-any.whl Python 3 none any Details

Total release size: 51.5 kB

Release files / azure_mixedreality_authentication-1.0.0b2.tar.gz

Download URL azure_mixedreality_authentication-1.0.0b2.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
43e8d39d13875cd9beebbb3b4fe499ad6b13390a86507f3aa8549a79f43a000c
BLAKE2b-256 checksum
How to use checksums
9aeca2906f0d8d2e3c58a2d7bd981d9ed5409fc4fa95b95cdad0f3c2d1567e5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / azure_mixedreality_authentication-1.0.0b2-py3-none-any.whl

Download URL azure_mixedreality_authentication-1.0.0b2-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b634abb22ef21206f1b2c99589c8cb68225ecbfdba5ed38b3607e1c80b077bc1
BLAKE2b-256 checksum
How to use checksums
62e61a4f8a0087ecfa653a08a0ad2be4243d8d6e8c26a8d9c81c16683211f4e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Security for azure-mixedreality-authentication 1.0.0b2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page