Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure Online Experimentation is a managed service that enables developers to create and manage experiment metrics for evaluating online A/B tests.
Source code | API reference documentation | Product documentation | Samples
Getting started
Install the package
Install the Azure Online Experimentation client library for .NET with NuGet:
dotnet add package Azure.Analytics.OnlineExperimentation --prerelease
Prerequisites
You need an Azure subscription with an Azure Online Experimentation workspace resource.
Authenticate the client
The Azure Online Experimentation client library initialization requires two parameters:
- The
endpoint
property value from theMicrosoft.OnlineExperimentation/workspaces
resource. - A
TokenCredential
for authentication, the simplest approach is to useDefaultAzureCredential
.
var endpoint = new Uri(Environment.GetEnvironmentVariable("AZURE_ONLINEEXPERIMENTATION_ENDPOINT"));
var client = new OnlineExperimentationClient(endpoint, new DefaultAzureCredential());
Select a service API version
You can explicitly select a supported service API version when instantiating a client:
var endpoint = new Uri(Environment.GetEnvironmentVariable("AZURE_ONLINEEXPERIMENTATION_ENDPOINT"));
var options = new OnlineExperimentationClientOptions(OnlineExperimentationClientOptions.ServiceVersion.V2025_05_31_Preview);
var client = new OnlineExperimentationClient(endpoint, new DefaultAzureCredential(), options);
Always ensure that the chosen API version is fully supported and operational for your specific use case and aligns with the service's versioning policy.
Key concepts
The Azure Online Experimentation client library provides the following key classes:
OnlineExperimentationClient
: Main client class for interacting with the service.DiagnosticDetail
: Represents diagnostic details for experiment metrics.
Thread safety
All client instances are thread-safe. It's recommended to reuse client instances across threads.
Additional concepts
Client options | Accessing the response | Handling failures | Diagnostics
Examples
Explore common scenarios using the samples:
Troubleshooting
Common exceptions include:
RequestFailedException
: Indicates a failure in the request. Inspect the exception message and status code for details.
Enable logging and diagnostics to debug issues:
var endpoint = new Uri(Environment.GetEnvironmentVariable("AZURE_ONLINEEXPERIMENTATION_ENDPOINT"));
var options = new OnlineExperimentationClientOptions()
{
Diagnostics =
{
IsLoggingContentEnabled = true
}
};
var client = new OnlineExperimentationClient(endpoint, new DefaultAzureCredential(), options);
Next steps
- Explore additional samples to learn more.
- Visit the Azure SDK for .NET repository for more libraries.
Contributing
See CONTRIBUTING.md for details on contributing to this library.
Azure SDK for .NET