Azure.Quantum.Jobs 1.0.0-beta.3 The ID prefix of this package has been reserved for one of the owners of this package by Prefix Reserved

.NET Standard 2.0
This is a prerelease version of Azure.Quantum.Jobs.
Install-Package Azure.Quantum.Jobs -Version 1.0.0-beta.3
dotnet add package Azure.Quantum.Jobs --version 1.0.0-beta.3
<PackageReference Include="Azure.Quantum.Jobs" Version="1.0.0-beta.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Azure.Quantum.Jobs --version 1.0.0-beta.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Azure.Quantum.Jobs, 1.0.0-beta.3"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Azure.Quantum.Jobs as a Cake Addin
#addin nuget:?package=Azure.Quantum.Jobs&version=1.0.0-beta.3&prerelease

// Install Azure.Quantum.Jobs as a Cake Tool
#tool nuget:?package=Azure.Quantum.Jobs&version=1.0.0-beta.3&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Azure Quantum Jobs client library for .NET

Azure Quantum is a Microsoft Azure service that you can use to run quantum computing programs or solve optimization problems in the cloud. Using the Azure Quantum tools and SDKs, you can create quantum programs and run them against different quantum simulators and machines. You can use the Azure.Quantum.Jobs client library to:

Getting started

This section should include everything a developer needs to do to install and create their first client connection very quickly.

Install the package

Install the Azure Quantum Jobs client library for .NET with NuGet:

dotnet add package Azure.Quantum.Jobs --prerelease -v 1.0.0-beta.1


Include a section after the install command that details any requirements that must be satisfied before a developer can authenticate and test all of the snippets in the Examples section. For example, for Cosmos DB:

You must have an Azure subscription, Cosmos DB account (SQL API), and Python 3.6+ to use this package.

Authenticate the client

To authenticate with the service, the workspace will use DefaultAzureCredential internally. This will try different authentication mechanisms based on the environment (e.g. Environment Variables, ManagedIdentity, CachedTokens) and finally it will fallback to InteractiveBrowserCredential.

Workspace will also allow the user to override the above behavior by passing their own TokenCredential.

TokenCredential is the default Authentication mechanism used by Azure SDKs.

Key concepts

QuantumJobClient is the root class to be used to authenticate and create, enumerate, and cancel jobs.

JobDetails contains all the properties of a job.

ProviderStatus contains status information for a provider.

QuantumJobQuota contains quota properties.

Thread safety

We guarantee that all client instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing client instances is always safe, even across threads.

Additional concepts

Client options | Accessing the response | Long-running operations | Handling failures | Diagnostics | Mocking | Client lifetime


Create the client

Create an instance of the QuantumJobClient by passing in these parameters:

  • Subscription - looks like XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX and can be found in your list of subscriptions on azure
  • Resource Group - a container that holds related resources for an Azure solution
  • Workspace - a collection of assets associated with running quantum or optimization applications
  • Location - choose the best data center by geographical region
  • StorageContainerName - your blob storage
  • Credential - used to authenticate
// Create a QuantumJobClient
var subscriptionId = "your_subscription_id";
var resourceGroupName = "your_resource_group_name";
var workspaceName = "your_quantum_workspace_name";
var location = "your_location";
var storageContainerName = "your_container_name";

var credential = new DefaultAzureCredential(true);

var quantumJobClient =
    new QuantumJobClient(

Get Container SAS URI

Create a storage container where to put your data.

// Get container Uri with SAS key
var containerUri = (quantumJobClient.GetStorageSasUri(
    new BlobDetails(storageContainerName))).Value.SasUri;

Upload Input Data

Using the SAS URI, upload the compressed json input data to the blob client. Note that we need to compress the json input data before uploading it to the blob storage. This contains the parameters to be used with Quantum Inspired Optimizations

string problemFilePath = "./problem.json";

// Get input data blob Uri with SAS key
string blobName = Path.GetFileName(problemFilePath);
var inputDataUri = (quantumJobClient.GetStorageSasUri(
    new BlobDetails(storageContainerName)
        BlobName = blobName,

using (var problemStreamToUpload = new MemoryStream())
    using (FileStream problemFileStream = File.OpenRead(problemFilePath))
        // Check if problem file is a gzip file.
        // If it is, just read its contents.
        // If not, read and compress the content.
        var fileExtension = Path.GetExtension(problemFilePath).ToLower();
        if (fileExtension == ".gz" ||
            fileExtension == ".gzip")
            using (var gzip = new GZipStream(problemStreamToUpload, CompressionMode.Compress, leaveOpen: true))
                byte[] buffer = new byte[8192];
                int count;
                while ((count = problemFileStream.Read(buffer, 0, buffer.Length)) > 0)
                    gzip.Write(buffer, 0, count);
    problemStreamToUpload.Position = 0;

    // Upload input data to blob
    var blobClient = new BlobClient(new Uri(inputDataUri));
    var blobHeaders = new BlobHttpHeaders
        ContentType = "application/json",
        ContentEncoding = "gzip"
    var blobUploadOptions = new BlobUploadOptions { HttpHeaders = blobHeaders };
    blobClient.Upload(problemStreamToUpload, options: blobUploadOptions);

Create The Job

Now that you've uploaded your problem definition to Azure Storage, you can use CreateJob to define an Azure Quantum job.

// Submit job
var jobId = $"job-{Guid.NewGuid():N}";
var jobName = $"jobName-{Guid.NewGuid():N}";
var inputDataFormat = "microsoft.qio.v2";
var outputDataFormat = "microsoft.qio-results.v2";
var providerId = "microsoft";
var target = "microsoft.paralleltempering-parameterfree.cpu";
var inputParams = new Dictionary<string, object>() { { "params", new Dictionary<string, object>() } };
var createJobDetails = new JobDetails(containerUri, inputDataFormat, providerId, target)
    Id = jobId,
    InputDataUri = inputDataUri,
    Name = jobName,
    InputParams = inputParams,
    OutputDataFormat = outputDataFormat

JobDetails myJob = (quantumJobClient.CreateJob(jobId, createJobDetails)).Value;

Get Job

GetJob retrieves a specific job by its id.

// Get the job that we've just created based on its jobId
myJob = (quantumJobClient.GetJob(jobId)).Value;

Get Jobs

To enumerate all the jobs in the workspace, use the GetJobs method.

foreach (JobDetails job in quantumJobClient.GetJobs())


All Quantum Jobs service operations will throw a RequestFailedException on failure with helpful ErrorCodes. Many of these errors are recoverable.

Next steps


See the for details on building, testing, and contributing to this library.

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

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

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Azure.Quantum.Jobs:

Package Downloads
Microsoft.Azure.Quantum.Client The ID prefix of this package has been reserved for one of the owners of this package by

Client library for Azure Quantum.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-beta.3 36,597 1/19/2022
1.0.0-beta.2 56,607 3/30/2021
1.0.0-beta.1 206 2/1/2021