From 5f4a94fd66507a8e0eeb829c4a4ee0c60d7bc685 Mon Sep 17 00:00:00 2001 From: Warren Jones Date: Wed, 20 Oct 2021 19:33:11 -0700 Subject: [PATCH] Replace deprecated CLIError with new error types (#3997) * Replace deprecated CLIError with new error types --- src/quantum/azext_quantum/_params.py | 7 +- src/quantum/azext_quantum/operations/job.py | 19 +- .../azext_quantum/operations/offerings.py | 6 +- .../azext_quantum/operations/workspace.py | 31 ++- .../recordings/test_workspace_errors.yaml | 260 ++++++++++++++++++ .../tests/latest/test_quantum_workspace.py | 21 ++ 6 files changed, 314 insertions(+), 30 deletions(-) create mode 100644 src/quantum/azext_quantum/tests/latest/recordings/test_workspace_errors.yaml diff --git a/src/quantum/azext_quantum/_params.py b/src/quantum/azext_quantum/_params.py index 60c4dc94fdc..f2b67b7a9fa 100644 --- a/src/quantum/azext_quantum/_params.py +++ b/src/quantum/azext_quantum/_params.py @@ -5,7 +5,8 @@ # pylint: disable=line-too-long,protected-access import argparse -from knack.arguments import CLIArgumentType, CLIError +from knack.arguments import CLIArgumentType +from azure.cli.core.azclierror import InvalidArgumentValueError class JobParamsAction(argparse._AppendAction): @@ -19,8 +20,8 @@ def get_action(self, values, option_string): try: key, value = item.split('=', 1) params[key] = value - except ValueError: - raise CLIError('Usage error: {} KEY=VALUE [KEY=VALUE ...]'.format(option_string)) + except ValueError as e: + raise InvalidArgumentValueError('Usage error: {} KEY=VALUE [KEY=VALUE ...]'.format(option_string)) from e return params diff --git a/src/quantum/azext_quantum/operations/job.py b/src/quantum/azext_quantum/operations/job.py index c6b126bde87..dc92b4ac44e 100644 --- a/src/quantum/azext_quantum/operations/job.py +++ b/src/quantum/azext_quantum/operations/job.py @@ -7,7 +7,8 @@ import logging -from knack.util import CLIError +from azure.cli.core.azclierror import (FileOperationError, AzureInternalError, + InvalidArgumentValueError, AzureResponseError) from .._client_factory import cf_jobs, _get_data_credentials, base_url from .workspace import WorkspaceInfo @@ -43,11 +44,11 @@ def _check_dotnet_available(): try: import subprocess result = subprocess.run(args, stdout=subprocess.PIPE, check=False) - except FileNotFoundError: - raise CLIError(f"Could not find 'dotnet' on the system.") + except FileNotFoundError as e: + raise FileOperationError("Could not find 'dotnet' on the system.") from e if result.returncode != 0: - raise CLIError(f"Failed to run 'dotnet'. (Error {result.returncode})") + raise FileOperationError(f"Failed to run 'dotnet'. (Error {result.returncode})") def build(cmd, target_id=None, project=None): @@ -78,7 +79,7 @@ def build(cmd, target_id=None, project=None): # If we got here, we might have encountered an error during compilation, so propagate standard output to the user. logger.error(f"Compilation stage failed with error code {result.returncode}") print(result.stdout.decode('ascii')) - raise CLIError("Failed to compile program.") + raise AzureInternalError("Failed to compile program.") def _generate_submit_args(program_args, ws, target, token, project, job_name, shots, storage, job_params): @@ -193,7 +194,7 @@ def submit(cmd, program_args, resource_group_name=None, workspace_name=None, loc # The program compiled succesfully, but executing the stand-alone .exe failed to run. logger.error(f"Submission of job failed with error code {result.returncode}") print(result.stdout.decode('ascii')) - raise CLIError("Failed to submit job.") + raise AzureInternalError("Failed to submit job.") def _parse_blob_url(url): @@ -205,8 +206,8 @@ def _parse_blob_url(url): container = o.path.split('/')[-2] blob = o.path.split('/')[-1] sas_token = o.query - except IndexError: - raise CLIError(f"Failed to parse malformed blob URL: {url}") + except IndexError as e: + raise InvalidArgumentValueError(f"Failed to parse malformed blob URL: {url}") from e return { "account_name": account_name, @@ -256,7 +257,7 @@ def output(cmd, job_id, resource_group_name=None, workspace_name=None, location= while result_start_line >= 0 and not lines[result_start_line].startswith('"'): result_start_line -= 1 if result_start_line < 0: - raise CLIError("Job output is malformed, mismatched quote characters.") + raise AzureResponseError("Job output is malformed, mismatched quote characters.") # Print the job output and then the result of the operation as a histogram. # If the result is a string, trim the quotation marks. diff --git a/src/quantum/azext_quantum/operations/offerings.py b/src/quantum/azext_quantum/operations/offerings.py index a784eadd9da..1ea58675b5f 100644 --- a/src/quantum/azext_quantum/operations/offerings.py +++ b/src/quantum/azext_quantum/operations/offerings.py @@ -5,7 +5,7 @@ # pylint: disable=line-too-long,redefined-builtin -from knack.util import CLIError +from azure.cli.core.azclierror import InvalidArgumentValueError, RequiredArgumentMissingError from .._client_factory import cf_offerings, cf_vm_image_term import time @@ -42,7 +42,7 @@ def _get_publisher_and_offer_from_provider_id(providers, provider_id): def _valid_publisher_and_offer(provider, publisher, offer): if (offer is None or publisher is None): - raise CLIError(f"Provider '{provider}' not found.") + raise InvalidArgumentValueError(f"Provider '{provider}' not found.") if (offer == OFFER_NOT_AVAILABLE or publisher == PUBLISHER_NOT_AVAILABLE): # We show this information to the user to prevent a confusion when term commands take no effect. _show_info(f"No terms require to be accepted for provider '{provider}'.") @@ -55,7 +55,7 @@ def list_offerings(cmd, location=None): Get the list of all provider offerings available on the given location. """ if (not location): - raise CLIError("A location is required to list offerings available.") + raise RequiredArgumentMissingError("A location is required to list offerings available.") client = cf_offerings(cmd.cli_ctx) return client.list(location_name=location) diff --git a/src/quantum/azext_quantum/operations/workspace.py b/src/quantum/azext_quantum/operations/workspace.py index 4eba19605f6..bb1d5a03767 100644 --- a/src/quantum/azext_quantum/operations/workspace.py +++ b/src/quantum/azext_quantum/operations/workspace.py @@ -5,7 +5,8 @@ # pylint: disable=line-too-long,redefined-builtin -from knack.util import CLIError +from azure.cli.core.azclierror import (InvalidArgumentValueError, AzureInternalError, + RequiredArgumentMissingError, ResourceNotFoundError) from .._client_factory import cf_workspaces, cf_quotas, cf_offerings from ..vendored_sdks.azure_mgmt_quantum.models import QuantumWorkspace @@ -97,19 +98,19 @@ def _add_quantum_providers(cmd, workspace, providers): for pair in providers.split(','): es = [e.strip() for e in pair.split('/')] if (len(es) != 2): - raise CLIError(f"Invalid Provider/SKU specified: '{pair.strip()}'") + raise InvalidArgumentValueError(f"Invalid Provider/SKU specified: '{pair.strip()}'") provider_id = es[0] sku = es[1] (publisher, offer) = _get_publisher_and_offer_from_provider_id(providers_in_region, provider_id) if (offer is None or publisher is None): - raise CLIError(f"Provider '{provider_id}' not found in region {workspace.location}.") + raise InvalidArgumentValueError(f"Provider '{provider_id}' not found in region {workspace.location}.") providers_selected.append({'provider_id': provider_id, 'sku': sku, 'offer_id': offer, 'publisher_id': publisher}) _show_tip(f"Workspace creation has been requested with the following providers:\n{providers_selected}") # Now that the providers have been requested, add each of them into the workspace for provider in providers_selected: if _provider_terms_need_acceptance(cmd, provider): - raise CLIError(f"Terms for Provider '{provider['provider_id']}' and SKU '{provider['sku']}' have not been accepted.\n" - "Use command 'az quantum offerings accept-terms' to accept them.") + raise InvalidArgumentValueError(f"Terms for Provider '{provider['provider_id']}' and SKU '{provider['sku']}' have not been accepted.\n" + "Use command 'az quantum offerings accept-terms' to accept them.") p = Provider() p.provider_id = provider['provider_id'] p.provider_sku = provider['sku'] @@ -123,7 +124,7 @@ def _create_role_assignment(cmd, quantum_workspace): try: create_role_assignment(cmd, role="Contributor", scope=quantum_workspace.storage_account, assignee=quantum_workspace.identity.principal_id) break - except (CloudError, CLIError) as e: + except (CloudError, AzureInternalError) as e: error = str(e.args).lower() if (("does not exist" in error) or ("cannot find" in error)): print('.', end='', flush=True) @@ -132,12 +133,12 @@ def _create_role_assignment(cmd, quantum_workspace): continue raise e except Exception as x: - raise CLIError(f"Role assignment encountered exception ({type(x).__name__}): {x}") + raise AzureInternalError(f"Role assignment encountered exception ({type(x).__name__}): {x}") if (retry_attempts > 0): print() # To end the line of the waiting indicators. if (retry_attempts == MAX_RETRIES_ROLE_ASSIGNMENT): max_time_in_seconds = MAX_RETRIES_ROLE_ASSIGNMENT * POLLING_TIME_DURATION - raise CLIError(f"Role assignment could not be added to storage account {quantum_workspace.storage_account} within {max_time_in_seconds} seconds.") + raise AzureInternalError(f"Role assignment could not be added to storage account {quantum_workspace.storage_account} within {max_time_in_seconds} seconds.") return quantum_workspace @@ -147,16 +148,16 @@ def create(cmd, resource_group_name=None, workspace_name=None, location=None, st """ client = cf_workspaces(cmd.cli_ctx) if (not workspace_name): - raise CLIError("An explicit workspace name is required for this command.") + raise RequiredArgumentMissingError("An explicit workspace name is required for this command.") if (not storage_account): - raise CLIError("A quantum workspace requires a valid storage account.") + raise RequiredArgumentMissingError("A quantum workspace requires a valid storage account.") if (not location): - raise CLIError("A location for the new quantum workspace is required.") + raise RequiredArgumentMissingError("A location for the new quantum workspace is required.") if (provider_sku_list is None): - raise CLIError("A list of Azure Quantum providers and SKUs is required.") + raise RequiredArgumentMissingError("A list of Azure Quantum providers and SKUs is required.") info = WorkspaceInfo(cmd, resource_group_name, workspace_name, location) if (not info.resource_group): - raise CLIError("Please run 'az quantum workspace set' first to select a default resource group.") + raise ResourceNotFoundError("Please run 'az quantum workspace set' first to select a default resource group.") quantum_workspace = _get_basic_quantum_workspace(location, info, storage_account) _add_quantum_providers(cmd, quantum_workspace, provider_sku_list) poller = client.begin_create_or_update(info.resource_group, info.name, quantum_workspace, polling=False) @@ -175,7 +176,7 @@ def delete(cmd, resource_group_name=None, workspace_name=None): client = cf_workspaces(cmd.cli_ctx) info = WorkspaceInfo(cmd, resource_group_name, workspace_name) if (not info.resource_group) or (not info.name): - raise CLIError("Please run 'az quantum workspace set' first to select a default Quantum Workspace.") + raise ResourceNotFoundError("Please run 'az quantum workspace set' first to select a default Quantum Workspace.") client.begin_delete(info.resource_group, info.name, polling=False) # If we deleted the current workspace, clear it curr_ws = WorkspaceInfo(cmd) @@ -202,7 +203,7 @@ def get(cmd, resource_group_name=None, workspace_name=None): client = cf_workspaces(cmd.cli_ctx) info = WorkspaceInfo(cmd, resource_group_name, workspace_name, None) if (not info.resource_group) or (not info.name): - raise CLIError("Please run 'az quantum workspace set' first to select a default Quantum Workspace.") + raise ResourceNotFoundError("Please run 'az quantum workspace set' first to select a default Quantum Workspace.") ws = client.get(info.resource_group, info.name) return ws diff --git a/src/quantum/azext_quantum/tests/latest/recordings/test_workspace_errors.yaml b/src/quantum/azext_quantum/tests/latest/recordings/test_workspace_errors.yaml new file mode 100644 index 00000000000..e333dbae1c4 --- /dev/null +++ b/src/quantum/azext_quantum/tests/latest/recordings/test_workspace_errors.yaml @@ -0,0 +1,260 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - quantum workspace create + Connection: + - keep-alive + ParameterSetName: + - -w -l -a -r --skip-role-assignment + User-Agent: + - AZURECLI/2.29.0 azsdk-python-mgmt-quantum/1.0.0b1 Python/3.9.7 (Windows-10-10.0.19043-SP0) + az-cli-ext/0.8.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Quantum/locations/westus2/offerings?api-version=2019-11-04-preview + response: + body: + string: "{\"value\":[{\"id\":\"1qbit\",\"name\":\"1Qloud Optimization Platform\",\"properties\":{\"description\":\"1QBit + 1Qloud Optimization Platform with Quantum Inspired Solutions\",\"providerType\":\"qio\",\"company\":\"1QBit\",\"managedApplication\":{\"publisherId\":\"1qbinformationtechnologies1580939206424\",\"offerId\":\"1qbit-1qloud-optimization-aq\"},\"targets\":[{\"id\":\"1qbit.tabu\",\"name\":\"1QBit + Quadratic Tabu Solver\",\"description\":\"An iterative heuristic algorithm + that uses local search techniques to solve a problem\",\"acceptedDataFormats\":[\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\",\"identity\"]},{\"id\":\"1qbit.pathrelinking\",\"name\":\"1QBit + Quadratic Path-Relinking Solver\",\"description\":\"The path-relinking algorithm + is a heuristic algorithm that uses the tabu search as a subroutine to solve + a QUBO problem\",\"acceptedDataFormats\":[\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\",\"identity\"]},{\"id\":\"1qbit.pticm\",\"name\":\"1QBit + Quadratic Parallel Tempering Isoenergetic Cluster Moves Solver\",\"description\":\"The + parallel tempering with isoenergetic cluster moves (PTICM) solver is a Monte + Carlo approach to solving QUBO problems\",\"acceptedDataFormats\":[\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\",\"identity\"]}],\"skus\":[{\"id\":\"1qbit-internal-free-plan\",\"version\":\"1.0.1\",\"name\":\"1QBit + No Charge Plan\",\"description\":\"1QBit plan with no charge for specific + customer arrangements\",\"targets\":[\"1qbit.tabu\",\"1qbit.pathrelinking\",\"1qbit.pticm\"],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"Tabu + Search Solver
Path-Relinking Solver
PTICM Solver\"},{\"id\":\"quota\",\"value\":\"N/A\"},{\"id\":\"price\",\"value\":\"Free + for select customers\"}]},{\"id\":\"1qbit-fixed-monthly-202012\",\"version\":\"1.0.1\",\"name\":\"Fixed + Monthly Plan\",\"description\":\"This plan provides access to all 1QBit quantum-inspired + optimization solvers with a flat monthly fee\",\"targets\":[\"1qbit.tabu\",\"1qbit.pathrelinking\",\"1qbit.pticm\"],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"Tabu + Search Solver
Path-Relinking Solver
PTICM Solver\"},{\"id\":\"quota\",\"value\":\"N/A\"},{\"id\":\"price\",\"value\":\"$7500 + USD per month\"}]},{\"id\":\"1qbit-pay-as-you-go-20210428\",\"version\":\"1.0.1\",\"name\":\"Pay + As You Go by CPU Usage\",\"description\":\"This plan provides access to all + 1QBit quantum-inspired optimization solvers with a pay as you go pricing\",\"targets\":[\"1qbit.tabu\",\"1qbit.pathrelinking\",\"1qbit.pticm\"],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"Tabu + Search Solver
Path-Relinking Solver
PTICM Solver\"},{\"id\":\"quota\",\"value\":\"N/A\"},{\"id\":\"price\",\"value\":\"$0.075 + per minute; rounded up to nearest second, with a minimum 1-second charge per + solve request\"}]}],\"pricingDimensions\":[{\"id\":\"features\",\"name\":\"Features\"},{\"id\":\"quota\",\"name\":\"Quota\"},{\"id\":\"price\",\"name\":\"Pricing\"}]}},{\"id\":\"honeywell\",\"name\":\"Honeywell + Quantum Solutions\",\"properties\":{\"description\":\"Access to Honeywell + Quantum Solutions' trapped-ion systems\",\"providerType\":\"qe\",\"company\":\"Honeywell\",\"managedApplication\":{\"publisherId\":\"honeywell-quantum\",\"offerId\":\"honeywell-quantum-aq\"},\"targets\":[{\"id\":\"honeywell.hqs-lt-s1\",\"name\":\"Honeywell + System Model: H1\",\"description\":\"Honeywell System Model H1\",\"acceptedDataFormats\":[\"honeywell.openqasm.v1\"],\"acceptedContentEncodings\":[\"gzip\",\"identity\"]},{\"id\":\"honeywell.hqs-lt-s2\",\"name\":\"Honeywell + System Model: H1-2\",\"description\":\"Honeywell System Model H1-2\",\"acceptedDataFormats\":[\"honeywell.openqasm.v1\"],\"acceptedContentEncodings\":[\"gzip\",\"identity\"]},{\"id\":\"honeywell.hqs-lt-s1-apival\",\"name\":\"H1 + API Validator\",\"description\":\"Honeywell System Model H1 API Validator\",\"acceptedDataFormats\":[\"honeywell.openqasm.v1\"],\"acceptedContentEncodings\":[\"gzip\",\"identity\"]},{\"id\":\"honeywell.hqs-lt-s2-apival\",\"name\":\"H1-2 + API Validator\",\"description\":\"Honeywell System Model H1-2 API Validator\",\"acceptedDataFormats\":[\"honeywell.openqasm.v1\"],\"acceptedContentEncodings\":[\"gzip\",\"identity\"]},{\"id\":\"honeywell.hqs-lt-s1-sim\",\"name\":\"H1 + Simulator\",\"description\":\"Honeywell System Model H1 Simulator\",\"acceptedDataFormats\":[\"honeywell.openqasm.v1\"],\"acceptedContentEncodings\":[\"gzip\",\"identity\"]}],\"skus\":[{\"id\":\"standard3\",\"version\":\"1.0.1\",\"name\":\"Standard\",\"description\":\"Monthly + subscription plan with 10K Honeywell quantum credits (HQCs) / month, available + through queue\",\"restrictedAccessUri\":\"mailto:HoneywellAzureQuantumSupport@Honeywell.com\",\"targets\":[\"honeywell.hqs-lt-s1\",\"honeywell.hqs-lt-s1-apival\",\"honeywell.hqs-lt-s2\",\"honeywell.hqs-lt-s2-apival\"],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"System + Model H1 API Validator
System Model H1 (10 qubits)\"},{\"id\":\"price\",\"value\":\"$ + 125,000 USD / Month\"}]},{\"id\":\"premium3\",\"version\":\"1.0.1\",\"name\":\"Premium\",\"description\":\"Monthly + subscription plan with 17K Honeywell quantum credits (HQCs) / month, available + through queue\",\"restrictedAccessUri\":\"mailto:HoneywellAzureQuantumSupport@Honeywell.com\",\"targets\":[\"honeywell.hqs-lt-s1\",\"honeywell.hqs-lt-s1-apival\",\"honeywell.hqs-lt-s2\",\"honeywell.hqs-lt-s2-apival\"],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"System + Model H1 API Validator
System Model H1 (10 qubits)\"},{\"id\":\"price\",\"value\":\"$ + 175,000 USD / Month\"}]},{\"id\":\"test1\",\"version\":\"1.0.1\",\"name\":\"Partner + Access\",\"description\":\"Charge-free access to Honeywell System Model H1 + for initial Azure integration verification\",\"targets\":[\"honeywell.hqs-lt-s1\",\"honeywell.hqs-lt-s1-apival\",\"honeywell.hqs-lt-s2\",\"honeywell.hqs-lt-s2-apival\",\"honeywell.hqs-lt-s1-sim\"],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"System + Model H0 API Validator
System Model H0 (6 qubits)\"},{\"id\":\"price\",\"value\":\"Free + for validation\"}]},{\"id\":\"credits1\",\"version\":\"1.0.1\",\"name\":\"Azure + Quantum Credits\",\"description\":\"Credits-based usage for Honeywell System + Model H1\",\"targets\":[\"honeywell.hqs-lt-s1\",\"honeywell.hqs-lt-s1-apival\",\"honeywell.hqs-lt-s2\",\"honeywell.hqs-lt-s2-apival\",\"honeywell.hqs-lt-s1-sim\"],\"quotaDimensions\":[{\"id\":\"hqc\",\"scope\":\"Subscription\"},{\"id\":\"ehqc\",\"scope\":\"Subscription\"}],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"System + Model H1 API Validator
System Model H1 (10 qubits)\"},{\"id\":\"price\",\"value\":\"Free, + up to the granted value of credits\"}]}],\"quotaDimensions\":[{\"id\":\"hqc\",\"scope\":\"Subscription\",\"quota\":0,\"period\":\"Infinite\",\"name\":\"Honeywell + Quantum Credit\",\"description\":\"Honeywell Quantum Credits are used to calculate + the cost of a job. See Honeywell documentation for more information.\",\"unit\":\"HQC\",\"unitPlural\":\"HQC's\"},{\"id\":\"ehqc\",\"scope\":\"Subscription\",\"quota\":0,\"period\":\"Infinite\",\"name\":\"Honeywell + Emulator QC\",\"description\":\"Honeywell Emulator Credits are used for job + estimation and the simulator.\",\"unit\":\"EHQC\",\"unitPlural\":\"EHQC's\"}],\"pricingDimensions\":[{\"id\":\"features\",\"name\":\"Features\"},{\"id\":\"price\",\"name\":\"Pricing\"}]}},{\"id\":\"ionq\",\"name\":\"IonQ\",\"properties\":{\"description\":\"IonQ\u2019s + trapped ion quantum computers perform calculations by manipulating charged + atoms of Ytterbium held in a vacuum with lasers.\",\"providerType\":\"qe\",\"company\":\"IonQ\",\"managedApplication\":{\"publisherId\":\"ionqinc1582730893633\",\"offerId\":\"ionq-aq\"},\"targets\":[{\"id\":\"ionq.simulator\",\"name\":\"Trapped + Ion Quantum Computer Simulator\",\"description\":\"GPU-accelerated idealized + simulator supporting up to 29 qubits, using the same gates IonQ provides on + its quantum computers. No errors are modeled at present.\",\"acceptedDataFormats\":[\"ionq.circuit.v1\"],\"acceptedContentEncodings\":[\"identity\"]},{\"id\":\"ionq.qpu\",\"name\":\"Trapped + Ion Quantum Computer\",\"description\":\"IonQ's quantum computer is dynamically + reconfigurable in software to use up to 11 qubits. All qubits are fully connected, + meaning you can run a two-qubit gate between any pair.\",\"acceptedDataFormats\":[\"ionq.circuit.v1\"],\"acceptedContentEncodings\":[\"identity\"]}],\"skus\":[{\"id\":\"pay-as-you-go\",\"version\":\"0.0.5\",\"name\":\"Pay + As You Go\",\"description\":\"A la carte access based on resource requirements + and usage.\",\"targets\":[\"ionq.qpu\",\"ionq.simulator\"],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"IonQ + Simulator
Trapped Ion QC (11 qubits)\"},{\"id\":\"quota\",\"value\":\"N/A\"},{\"id\":\"price\",\"value\":\"$ + 3,000.00 USD / hour (est)
See preview documentation for details\"}]},{\"id\":\"pay-as-you-go-cred\",\"version\":\"0.0.5\",\"name\":\"Azure + Quantum Credits\",\"description\":\"The Azure Quantum Credits program provides + sponsored access to quantum hardware through Azure. You will not be charged + for usage created under the credits program, up to the limit of your credit + grant.\",\"targets\":[\"ionq.qpu\",\"ionq.simulator\"],\"quotaDimensions\":[{\"id\":\"qgs\",\"scope\":\"Subscription\"}],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"IonQ + Simulator
Trapped Ion QC (11 qubits)\"},{\"id\":\"quota\",\"value\":\"Based + on granted value.\"},{\"id\":\"price\",\"value\":\"Sponsored\"}]},{\"id\":\"ionq-standard\",\"version\":\"0.0.5\",\"name\":\"IonQ + Standard\",\"description\":\"You're testing, so it's free! As in beer.\",\"targets\":[\"ionq.qpu\",\"ionq.simulator\"],\"pricingDetails\":[{\"id\":\"features\",\"value\":\"IonQ + Simulator
Trapped Ion QC (11 qubits)\"},{\"id\":\"quota\",\"value\":\"N/A\"},{\"id\":\"price\",\"value\":\"Free\"}]}],\"quotaDimensions\":[{\"id\":\"qgs\",\"scope\":\"Subscription\",\"quota\":0,\"period\":\"Infinite\",\"name\":\"Credit + [Subscription]\",\"description\":\"Credited resource usage against your account. + See IonQ documentation for more information: https://aka.ms/AQ/IonQ/ProviderDocumentation.\",\"unit\":\"qubit-gate-shot\",\"unitPlural\":\"qubit-gate-shots\"}],\"pricingDimensions\":[{\"id\":\"features\",\"name\":\"Features\"},{\"id\":\"quota\",\"name\":\"Quota\"},{\"id\":\"price\",\"name\":\"Pricing\"}]}},{\"id\":\"Microsoft\",\"name\":\"Microsoft + QIO\",\"properties\":{\"description\":\"Ground-breaking optimization algorithms + inspired by decades of quantum research.\",\"providerType\":\"qio\",\"company\":\"Microsoft\",\"managedApplication\":{\"publisherId\":\"N/A\",\"offerId\":\"N/A\"},\"targets\":[{\"id\":\"microsoft.paralleltempering.cpu\",\"name\":\"microsoft.paralleltempering.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v1\",\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.simulatedannealing-parameterfree.cpu\",\"name\":\"microsoft.simulatedannealing-parameterfree.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v1\",\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.paralleltempering-parameterfree.cpu\",\"name\":\"microsoft.paralleltempering-parameterfree.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v1\",\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.simulatedannealing.cpu\",\"name\":\"microsoft.simulatedannealing.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v1\",\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.tabu.cpu\",\"name\":\"microsoft.tabu.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v1\",\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.tabu-parameterfree.cpu\",\"name\":\"microsoft.tabu-parameterfree.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v1\",\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.qmc.cpu\",\"name\":\"microsoft.qmc.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v1\",\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.populationannealing.cpu\",\"name\":\"microsoft.populationannealing.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.substochasticmontecarlo.cpu\",\"name\":\"microsoft.substochasticmontecarlo.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.substochasticmontecarlo-parameterfree.cpu\",\"name\":\"microsoft.substochasticmontecarlo-parameterfree.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]},{\"id\":\"microsoft.populationannealing-parameterfree.cpu\",\"name\":\"microsoft.populationannealing-parameterfree.cpu\",\"acceptedDataFormats\":[\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]}],\"skus\":[{\"id\":\"Basic\",\"version\":\"1.0\",\"name\":\"Private + Preview\",\"description\":\"Free Private Preview access through February 15 + 2020\",\"targets\":[\"microsoft.paralleltempering-parameterfree.cpu\",\"microsoft.paralleltempering.cpu\",\"microsoft.simulatedannealing-parameterfree.cpu\",\"microsoft.simulatedannealing.cpu\",\"microsoft.tabu-parameterfree.cpu\",\"microsoft.tabu.cpu\",\"microsoft.qmc.cpu\",\"microsoft.populationannealing.cpu\",\"microsoft.populationannealing-parameterfree.cpu\",\"microsoft.substochasticmontecarlo.cpu\",\"microsoft.substochasticmontecarlo-parameterfree.cpu\",\"microsoft.populationannealing-parameterfree.cpu\"],\"quotaDimensions\":[{\"id\":\"combined_job_hours\",\"scope\":\"Workspace\"},{\"id\":\"combined_job_hours\",\"scope\":\"Subscription\"},{\"id\":\"concurrent_cpu_jobs\",\"scope\":\"Workspace\"},{\"id\":\"fpga_job_hours\",\"scope\":\"Workspace\"},{\"id\":\"fpga_job_hours\",\"scope\":\"Subscription\"},{\"id\":\"concurrent_fpga_jobs\",\"scope\":\"Workspace\"}],\"pricingDetails\":[{\"id\":\"targets\",\"value\":\"Simulated + Annealing
Parallel Tempering
Tabu Search
Substochastic Monte Carlo
Population + Annealing
all solvers above have a parameter-free mode

Quantum + Monte Carlo\"},{\"id\":\"perf\",\"value\":\"CPU based: Up to 5 concurrent + jobs\"},{\"id\":\"quota\",\"value\":\"CPU based: 5 hours / month\"},{\"id\":\"price\",\"value\":\"$ + 0\"}]},{\"id\":\"DZH3178M639F\",\"version\":\"1.0\",\"name\":\"Learn & Develop\",\"description\":\"Learn + and develop with Optimization solutions.\",\"targets\":[\"microsoft.paralleltempering-parameterfree.cpu\",\"microsoft.paralleltempering.cpu\",\"microsoft.simulatedannealing-parameterfree.cpu\",\"microsoft.simulatedannealing.cpu\",\"microsoft.tabu-parameterfree.cpu\",\"microsoft.tabu.cpu\",\"microsoft.qmc.cpu\",\"microsoft.populationannealing.cpu\",\"microsoft.populationannealing-parameterfree.cpu\",\"microsoft.substochasticmontecarlo.cpu\",\"microsoft.substochasticmontecarlo-parameterfree.cpu\"],\"quotaDimensions\":[{\"id\":\"combined_job_hours\",\"scope\":\"Workspace\",\"quota\":20},{\"id\":\"combined_job_hours\",\"scope\":\"Subscription\"},{\"id\":\"concurrent_cpu_jobs\",\"scope\":\"Workspace\"},{\"id\":\"concurrent_fpga_jobs\",\"scope\":\"Workspace\",\"quota\":2},{\"id\":\"fpga_job_hours\",\"scope\":\"Workspace\"},{\"id\":\"fpga_job_hours\",\"scope\":\"Subscription\"}],\"pricingDetails\":[{\"id\":\"targets\",\"value\":\"Simulated + Annealing
Parallel Tempering
Tabu Search
Substochastic Monte Carlo
Population + Annealing
all solvers above have a parameter-free mode

Quantum + Monte Carlo\"},{\"id\":\"perf\",\"value\":\"CPU based: Up to 5 concurrent + jobs\"},{\"id\":\"quota\",\"value\":\"CPU based: 20 hours / month\"},{\"id\":\"price\",\"value\":\"Pay + as you go
1 free hour included

See + pricing sheet\"}]},{\"id\":\"DZH318RV7MW4\",\"version\":\"1.0\",\"name\":\"Scale\",\"description\":\"Deploy + world-class Optimization solutions.\",\"targets\":[\"microsoft.paralleltempering-parameterfree.cpu\",\"microsoft.paralleltempering.cpu\",\"microsoft.simulatedannealing-parameterfree.cpu\",\"microsoft.simulatedannealing.cpu\",\"microsoft.tabu-parameterfree.cpu\",\"microsoft.tabu.cpu\",\"microsoft.qmc.cpu\",\"microsoft.populationannealing.cpu\",\"microsoft.populationannealing-parameterfree.cpu\",\"microsoft.substochasticmontecarlo.cpu\",\"microsoft.substochasticmontecarlo-parameterfree.cpu\"],\"quotaDimensions\":[{\"id\":\"combined_job_hours\",\"scope\":\"Workspace\",\"quota\":1000},{\"id\":\"combined_job_hours\",\"scope\":\"Subscription\"},{\"id\":\"concurrent_cpu_jobs\",\"scope\":\"Workspace\",\"quota\":100},{\"id\":\"concurrent_fpga_jobs\",\"scope\":\"Workspace\",\"quota\":10},{\"id\":\"fpga_job_hours\",\"scope\":\"Workspace\",\"quota\":1000},{\"id\":\"fpga_job_hours\",\"scope\":\"Subscription\"}],\"pricingDetails\":[{\"id\":\"targets\",\"value\":\"Simulated + Annealing
Parallel Tempering
Tabu Search
Substochastic Monte Carlo
Population + Annealing
all solvers above have a parameter-free mode

Quantum + Monte Carlo\"},{\"id\":\"perf\",\"value\":\"CPU based: Up to 100 concurrent + jobs\"},{\"id\":\"quota\",\"value\":\"Up to 50,000 hours / month\"},{\"id\":\"price\",\"value\":\"Pay + as you go
1 free hour included

See + pricing sheet\"}]},{\"id\":\"EarlyAccess\",\"version\":\"1.0\",\"name\":\"Early + Access\",\"description\":\"Help us test new capabilities in our Microsoft + Optimization provider. This SKU is available to a select group of users and + limited to targets that we are currently running an Early Access test for.\",\"targets\":[],\"quotaDimensions\":[{\"id\":\"combined_job_hours\",\"scope\":\"Workspace\",\"quota\":10},{\"id\":\"combined_job_hours\",\"scope\":\"Subscription\"},{\"id\":\"concurrent_cpu_jobs\",\"scope\":\"Workspace\"},{\"id\":\"fpga_job_hours\",\"scope\":\"Workspace\"},{\"id\":\"fpga_job_hours\",\"scope\":\"Subscription\"},{\"id\":\"concurrent_fpga_jobs\",\"scope\":\"Workspace\"}],\"pricingDetails\":[{\"id\":\"targets\",\"value\":\"No + targets are currently in Early Access\"},{\"id\":\"quota\",\"value\":\"CPU + based: 10 hours / month\"},{\"id\":\"price\",\"value\":\"$ 0\"}]}],\"quotaDimensions\":[{\"id\":\"combined_job_hours\",\"scope\":\"Workspace\",\"quota\":5,\"period\":\"Monthly\",\"name\":\"CPU + Solver Hours [Workspace]\",\"description\":\"The amount of CPU solver time + you may use per month within this workspace\",\"unit\":\"hour\",\"unitPlural\":\"hours\"},{\"id\":\"combined_job_hours\",\"scope\":\"Subscription\",\"quota\":1000,\"period\":\"Monthly\",\"name\":\"CPU + Solver Hours [Subscription]\",\"description\":\"The amount of CPU solver time + you may use per month shared by all workspaces within the subscription\",\"unit\":\"hour\",\"unitPlural\":\"hours\"},{\"id\":\"concurrent_cpu_jobs\",\"scope\":\"Workspace\",\"quota\":5},{\"id\":\"concurrent_fpga_jobs\",\"scope\":\"Workspace\",\"quota\":1},{\"id\":\"fpga_job_hours\",\"scope\":\"Workspace\",\"quota\":1,\"period\":\"Monthly\",\"name\":\"FPGA + Solver Hours [Workspace]\",\"description\":\"The amount of FPGA solver time + you may use per month within this workspace\",\"unit\":\"hour\",\"unitPlural\":\"hours\"},{\"id\":\"fpga_job_hours\",\"scope\":\"Subscription\",\"quota\":1000,\"period\":\"Monthly\",\"name\":\"FPGA + Solver Hours [Subscription]\",\"description\":\"The amount of FPGA solver + time you may use per month shared by all workspaces within the subscription\",\"unit\":\"hour\",\"unitPlural\":\"hours\"}],\"pricingDimensions\":[{\"id\":\"targets\",\"name\":\"Targets + available\"},{\"id\":\"perf\",\"name\":\"Performance\"},{\"id\":\"quota\",\"name\":\"Quota\"},{\"id\":\"price\",\"name\":\"Price + per month\"}]}},{\"id\":\"Microsoft.FleetManagement\",\"name\":\"Microsoft + Fleet Management Solution\",\"properties\":{\"description\":\"(Preview) Leverage + Azure Quantum's advanced optimization algorithms to solve fleet management + problems.\",\"providerType\":\"qio\",\"company\":\"Microsoft\",\"managedApplication\":{\"publisherId\":\"N/A\",\"offerId\":\"N/A\"},\"targets\":[{\"id\":\"microsoft.fleetmanagement\",\"name\":\"microsoft.fleetmanagement\",\"acceptedDataFormats\":[\"microsoft.fleetmanagement.v1\"],\"acceptedContentEncodings\":[\"gzip\"]}],\"skus\":[{\"id\":\"Basic\",\"version\":\"1.0\",\"name\":\"Private + Preview\",\"description\":\"Private preview fleet management SKU.\",\"targets\":[\"microsoft.fleetManagement\"],\"quotaDimensions\":[{\"id\":\"combined_job_hours\",\"scope\":\"Workspace\"},{\"id\":\"combined_job_hours\",\"scope\":\"Subscription\"},{\"id\":\"concurrent_cpu_jobs\",\"scope\":\"Workspace\"}]}],\"quotaDimensions\":[{\"id\":\"combined_job_hours\",\"scope\":\"Workspace\",\"quota\":20,\"period\":\"Monthly\",\"name\":\"Job + Hours [Workspace]\",\"description\":\"The amount of job time you may use per + month within this workspace\",\"unit\":\"hour\",\"unitPlural\":\"hours\"},{\"id\":\"combined_job_hours\",\"scope\":\"Subscription\",\"quota\":1000,\"period\":\"Monthly\",\"name\":\"Job + Hours [Subscription]\",\"description\":\"The amount of job time you may use + per month shared by all workspaces within the subscription\",\"unit\":\"hour\",\"unitPlural\":\"hours\"},{\"id\":\"concurrent_cpu_jobs\",\"scope\":\"Workspace\",\"quota\":5}]}},{\"id\":\"Microsoft.Simulator\",\"name\":\"Microsoft + Simulation Tools\",\"properties\":{\"description\":\"Microsoft Simulation + Tools.\",\"providerType\":\"qe\",\"company\":\"Microsoft\",\"managedApplication\":{\"publisherId\":\"N/A\",\"offerId\":\"N/A\"},\"targets\":[{\"id\":\"microsoft.simulator.fullstate\",\"name\":\"Quantum + Simulator\",\"acceptedDataFormats\":[\"microsoft.qir.v1\"],\"acceptedContentEncodings\":[\"gzip\"]}],\"skus\":[{\"id\":\"Basic\",\"version\":\"1.0\",\"name\":\"Private + Preview\",\"description\":\"Private preview simulator SKU.\",\"targets\":[\"microsoft.simulator.fullstate\"],\"quotaDimensions\":[{\"id\":\"simulator_job_hours\",\"scope\":\"Workspace\"},{\"id\":\"simulator_job_hours\",\"scope\":\"Subscription\"},{\"id\":\"concurrent_simulator_jobs\",\"scope\":\"Workspace\"}]}],\"quotaDimensions\":[{\"id\":\"simulator_job_hours\",\"scope\":\"Workspace\",\"quota\":20,\"period\":\"Monthly\",\"name\":\"Simulator + Hours [Workspace]\",\"description\":\"The amount of simulator time you may + use per month within this workspace\",\"unit\":\"hour\",\"unitPlural\":\"hours\"},{\"id\":\"simulator_job_hours\",\"scope\":\"Subscription\",\"quota\":1000,\"period\":\"Monthly\",\"name\":\"Simulator + Hours [Subscription]\",\"description\":\"The amount of simulator time you + may use per month shared by all workspaces within the subscription\",\"unit\":\"hour\",\"unitPlural\":\"hours\"},{\"id\":\"concurrent_simulator_jobs\",\"scope\":\"Workspace\",\"quota\":5}]}},{\"id\":\"qci\",\"name\":\"Quantum + Circuits, Inc.\",\"properties\":{\"description\":\"Superconducting circuits + QC\",\"providerType\":\"qe\",\"company\":\"Quantum Circuits, Inc.\",\"managedApplication\":{\"publisherId\":\"quantumcircuitsinc1598045891596\",\"offerId\":\"quantumcircuitsinc-aq-test-preview\"},\"targets\":[{\"id\":\"qci.machine1\",\"name\":\"Machine + 1\",\"description\":\"Machine 1 Description\",\"acceptedDataFormats\":[\"qci.qcdl.v1\"],\"acceptedContentEncodings\":[\"identity\"]},{\"id\":\"qci.simulator\",\"name\":\"Simulator\",\"description\":\"Simulator + Description\",\"acceptedDataFormats\":[\"qci.qcdl.v1\"],\"acceptedContentEncodings\":[\"identity\"]}],\"skus\":[{\"id\":\"test\",\"version\":\"0.1.0\",\"name\":\"test\",\"description\":\"test + sku\",\"targets\":[\"qci.simulator\",\"qci.machine1\"],\"quotaDimensions\":[{\"id\":\"jobcount\",\"scope\":\"Workspace\"}]}],\"quotaDimensions\":[{\"id\":\"jobcount\",\"scope\":\"Workspace\",\"quota\":1000,\"period\":\"Monthly\",\"name\":\"Job + Count\",\"description\":\"Number of jobs you can run in a month.\",\"unit\":\"job\",\"unitPlural\":\"jobs\"}]}},{\"id\":\"toshiba\",\"name\":\"Toshiba + SBM\",\"properties\":{\"description\":\"Toshiba Simulated Bifurcation Machine + (SBM) for Azure Quantum\",\"providerType\":\"qio\",\"company\":\"Toshiba Digital + Solutions Corporation\",\"managedApplication\":{\"publisherId\":\"2812187\",\"offerId\":\"toshiba-aq\"},\"targets\":[{\"id\":\"toshiba.sbm.ising\",\"name\":\"Ising + solver\",\"description\":\"SBM is a practical and ready-to-use ISING machine + that solves large-scale \\\"combinatorial optimization problems\\\" at high + speed.\",\"acceptedDataFormats\":[\"microsoft.qio.v2\"],\"acceptedContentEncodings\":[\"gzip\"]}],\"skus\":[{\"id\":\"toshiba-solutionseconds\",\"version\":\"1.0.1\",\"name\":\"Pay + As You Go\",\"description\":\"This is the only plan for using SBM in Azure + Quantum Private Preview.\",\"targets\":[\"toshiba.sbm.ising\"],\"pricingDetails\":[{\"id\":\"price\",\"value\":\"This + plan is available for free during private preview.\"}]}],\"pricingDimensions\":[{\"id\":\"price\",\"name\":\"Pricing\"}]}}]}" + headers: + cache-control: + - no-cache + content-length: + - '22559' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 20 Oct 2021 22:18:29 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: '{"location": "westus2", "identity": {"type": "SystemAssigned"}, "properties": + {"providers": [{"providerId": "Microsoft", "providerSku": "Basic"}], "storageAccount": + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/e2e-scenarios/providers/Microsoft.Storage/storageAccounts/e2etests"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - quantum workspace create + Connection: + - keep-alive + Content-Length: + - '302' + Content-Type: + - application/json + ParameterSetName: + - -w -l -a -r --skip-role-assignment + User-Agent: + - AZURECLI/2.29.0 azsdk-python-mgmt-quantum/1.0.0b1 Python/3.9.7 (Windows-10-10.0.19043-SP0) + az-cli-ext/0.8.0 + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/e2e-scenarios/providers/Microsoft.Quantum/workspaces/e2e-test-w7164078?api-version=2019-11-04-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/e2e-scenarios/providers/Microsoft.Quantum/workspaces/e2e-test-w7164078","name":"e2e-test-w7164078","type":"microsoft.quantum/workspaces","location":"westus2","systemData":{"createdBy":"v-wjones@microsoft.com","createdByType":"User","createdAt":"2021-10-20T22:18:31.3777068Z","lastModifiedBy":"v-wjones@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2021-10-20T22:18:31.3777068Z"},"identity":{"principalId":"71792197-52e7-4bf1-882f-efd4512bf2d3","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"providers":[{"providerId":"Microsoft","providerSku":"Basic","applicationName":"e2e-test-w7164078-Microsoft","provisioningState":"Launching"}],"provisioningState":"Accepted","usable":"No","storageAccount":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/e2e-scenarios/providers/Microsoft.Storage/storageAccounts/e2etests"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/providers/Microsoft.Quantum/locations/WESTUS2/operationStatuses/c994e71a-0f55-44bd-a057-6cd00ea7247d*D5D93E7051E5EDE94E1E8E4B4A67216218D3E454FE9A6060E189AAD31916A390?api-version=2019-11-04-preview + cache-control: + - no-cache + content-length: + - '964' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 20 Oct 2021 22:18:33 GMT + etag: + - '"fc008570-0000-0800-0000-617095b90000"' + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:4d6ac272-7369-45c6-9036-63d733c8519f + set-cookie: + - ARRAffinity=14997f4c5744dc2dd6f1d030811af84714935ccafad4803799f4ee84048b04b3;Path=/;HttpOnly;Secure;Domain=app-cp-westcentralus.azurewebsites.net + - ARRAffinitySameSite=14997f4c5744dc2dd6f1d030811af84714935ccafad4803799f4ee84048b04b3;Path=/;HttpOnly;SameSite=None;Secure;Domain=app-cp-westcentralus.azurewebsites.net + - ASLBSA=408392c61f0d31b7c893857631c302d95c61c7c215089eb24b1c72720d55d8ec; path=/; + secure + - ASLBSACORS=408392c61f0d31b7c893857631c302d95c61c7c215089eb24b1c72720d55d8ec; + samesite=none; path=/; secure + strict-transport-security: + - max-age=31536000; includeSubDomains + x-azure-ref: + - 0uZVwYQAAAACTAckdpAlIQqgNabPwduL4V1NURURHRTA4MTMAMzJhNzJjYWUtNWM3YS00NTk4LWEyOWYtYzkyMzM3OWUzMzcx + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 201 + message: Created +version: 1 diff --git a/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py b/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py index aafdb168db1..5be3608e5e5 100644 --- a/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py +++ b/src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py @@ -8,6 +8,7 @@ from azure_devtools.scenario_tests import AllowLargeResponse, live_only from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer) +from azure.cli.core.azclierror import RequiredArgumentMissingError, ResourceNotFoundError from .utils import get_test_resource_group, get_test_workspace, get_test_workspace_location, get_test_workspace_storage, get_test_workspace_random_name from ..._version_check_helper import check_version @@ -68,6 +69,26 @@ def test_workspace_create_destroy(self): self.check("provisioningState", "Deleting") ]) + @live_only() + def test_workspace_errors(self): + # initialize values + test_location = get_test_workspace_location() + test_resource_group = get_test_resource_group() + test_workspace_temp = get_test_workspace_random_name() + test_storage_account = get_test_workspace_storage() + + # Attempt to create workspace, but omit the provider/SKU parameter + try: + self.cmd(f'az quantum workspace create -g {test_resource_group} -w {test_workspace_temp} -l {test_location} -a {test_storage_account} --skip-role-assignment') + except RequiredArgumentMissingError: + pass + + # Attempt to create workspace, but omit the resource group parameter + try: + self.cmd(f'az quantum workspace create -w {test_workspace_temp} -l {test_location} -a {test_storage_account} -r "Microsoft/Basic" --skip-role-assignment') + except ResourceNotFoundError: + pass + @live_only() def test_version_check(self): # initialize values