Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions azure-quantum/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@ AZURE_TEST_RUN_LIVE="True"

This will force the recording files to be deleted before running the tests.

To be able to run the tests in recording or live mode, make sure:

- You have a client app registered in Microsoft Entra ID (formerly Azure Active Directory)
- The client app is configured with [certificate-based authentication](https://learn.microsoft.com/en-us/entra/identity/authentication/how-to-certificate-based-authentication)
- The client app has "Contributor" permissions to your Azure Quantum Workspace
- The following environment variables are set:
- `AZURE_CLIENT_ID` - application (client) ID from Microsoft Entra ID
- `AZURE_TENANT_ID` - directory (tenant) ID from Microsoft Entra ID
- `AZURE_CLIENT_CERTIFICATE_PATH` - path to PEM or PKCS12 certificate file (including the private key) that is configured for the client app
- `AZURE_CLIENT_SEND_CERTIFICATE_CHAIN=True` - prompts Azure.Identity to set X5C header (specifying certificate chain) required to support SNI authentication
To run the tests in recording or live mode, make sure:

- You have installed [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest).
- You're logged into your Azure Entra ID Tenant in the Azure CLI - `az login` (or `az login --tenant <tenantId>`).
- You have "Quantum Workspace Owner" or "Quantum Workspace Data Contributor" or "Contributor" role on the Azure Quantum Workspace against which you would like to capture the recordings.
- You have all necessary Providers added to the Azure Quantum Workspace.
- The following environment variables are set:
- `AZURE_QUANTUM_SUBSCRIPTION_ID` - ID of the Subscription where Azure Quantum Workspace is deployed
- `AZURE_QUANTUM_WORKSPACE_RG` - name of the Resource Group where Azure Quantum Workspace is deployed
- `AZURE_QUANTUM_WORKSPACE_NAME` - name of the Azure Quantum Workspace
- `AZURE_QUANTUM_WORKSPACE_LOCATION` - Azure region where the Azure Quantum Workspace is deployed


## Recordings

Our testing infrastructure uses Python VCR to record HTTP calls against a live service and then use
Expand Down
4 changes: 2 additions & 2 deletions azure-quantum/tests/unit/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
)
from azure.quantum import Job
from azure.quantum.target import Target
from azure.identity import ClientSecretCredential
from azure.identity import ClientSecretCredential, AzureCliCredential


ZERO_UID = "00000000-0000-0000-0000-000000000000"
Expand Down Expand Up @@ -304,7 +304,7 @@ def create_workspace(
client_secret=PLACEHOLDER)

workspace = Workspace(
credential=credential,
credential=credential if credential else AzureCliCredential(),
subscription_id=connection_params.subscription_id,
resource_group=connection_params.resource_group,
name=connection_params.workspace_name,
Expand Down
Loading