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.
Use Azure CLI when you already have an input file that's compiled to QIR and you want to submit the job from a terminal, shell script, or CI/CD workflow. Azure CLI manages the Azure Quantum workspace, target, job metadata, and input file, but doesn't compile programs into QIR for you.
The exact method to submit a job with Azure CLI depends on the Azure Quantum target. The following steps are a general example of how to submit a QIR job with Azure CLI.
Install Azure CLI support
Install Azure CLI.
Install or update the Azure Quantum extension.
az extension add --upgrade --name quantum
Connect to your workspace
Sign in to Azure.
az loginSet the subscription that contains your Azure Quantum workspace.
az account set --subscription <subscription-id>Set the default workspace for subsequent commands.
az quantum workspace set \ --resource-group <resource-group-name> \ --workspace-name <workspace-name>List the targets that are available in the workspace.
az quantum target list --output table
Submit a compiled input file
For a QIR job, specify the target, job name, QIR input format, input file, and QIR entry point.
az quantum job submit \
--target-id <target-id> \
--job-name <job-name> \
--job-input-format qir.v1 \
--job-input-file <path-to-qir-file> \
--entry-point ENTRYPOINT__main
The command returns the job ID. Save the ID so that you can monitor the job and retrieve its output.
Note
This example shows common QIR parameters. A provider-native job can require different input and output formats or additional parameters. See the documentation for the selected target and the az quantum job command reference.
Monitor the job and get the output
To check the job status, run the following command.
az quantum job show --job-id <job-id> --output table
To get the output from a successful job, run the following command:
az quantum job output --job-id <job-id> --output table
For workspace setup and other Azure Quantum commands, see Manage quantum workspaces with Azure CLI.