Skip to content

Commit 660a19a

Browse files
authored
fix: use Azure CLI by default for capturing test recordings (microsoft#686)
1 parent ce248df commit 660a19a

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

azure-quantum/tests/README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,18 @@ AZURE_TEST_RUN_LIVE="True"
1717

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

20-
To be able to run the tests in recording or live mode, make sure:
21-
22-
- You have a client app registered in Microsoft Entra ID (formerly Azure Active Directory)
23-
- The client app is configured with [certificate-based authentication](https://learn.microsoft.com/en-us/entra/identity/authentication/how-to-certificate-based-authentication)
24-
- The client app has "Contributor" permissions to your Azure Quantum Workspace
25-
- The following environment variables are set:
26-
- `AZURE_CLIENT_ID` - application (client) ID from Microsoft Entra ID
27-
- `AZURE_TENANT_ID` - directory (tenant) ID from Microsoft Entra ID
28-
- `AZURE_CLIENT_CERTIFICATE_PATH` - path to PEM or PKCS12 certificate file (including the private key) that is configured for the client app
29-
- `AZURE_CLIENT_SEND_CERTIFICATE_CHAIN=True` - prompts Azure.Identity to set X5C header (specifying certificate chain) required to support SNI authentication
20+
To run the tests in recording or live mode, make sure:
21+
22+
- You have installed [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest).
23+
- You're logged into your Azure Entra ID Tenant in the Azure CLI - `az login` (or `az login --tenant <tenantId>`).
24+
- 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.
25+
- You have all necessary Providers added to the Azure Quantum Workspace.
26+
- The following environment variables are set:
3027
- `AZURE_QUANTUM_SUBSCRIPTION_ID` - ID of the Subscription where Azure Quantum Workspace is deployed
3128
- `AZURE_QUANTUM_WORKSPACE_RG` - name of the Resource Group where Azure Quantum Workspace is deployed
3229
- `AZURE_QUANTUM_WORKSPACE_NAME` - name of the Azure Quantum Workspace
3330
- `AZURE_QUANTUM_WORKSPACE_LOCATION` - Azure region where the Azure Quantum Workspace is deployed
3431

35-
3632
## Recordings
3733

3834
Our testing infrastructure uses Python VCR to record HTTP calls against a live service and then use

azure-quantum/tests/unit/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
)
2727
from azure.quantum import Job
2828
from azure.quantum.target import Target
29-
from azure.identity import ClientSecretCredential
29+
from azure.identity import ClientSecretCredential, AzureCliCredential
3030

3131

3232
ZERO_UID = "00000000-0000-0000-0000-000000000000"
@@ -304,7 +304,7 @@ def create_workspace(
304304
client_secret=PLACEHOLDER)
305305

306306
workspace = Workspace(
307-
credential=credential,
307+
credential=credential if credential else AzureCliCredential(),
308308
subscription_id=connection_params.subscription_id,
309309
resource_group=connection_params.resource_group,
310310
name=connection_params.workspace_name,

0 commit comments

Comments
 (0)