-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Quantum] Use Post Storage URI and SAS token like Quantum Python SDK (27643) #8242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kairu-ms
merged 33 commits into
Azure:main
from
warren-jones:27643-use-post-storage-uri-and-sas
Mar 11, 2025
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
e3c8054
Temporarily append '.dev3' to version number
warren-jones d818972
Calling upload-blob with return_sas_token = True
warren-jones b6fa1db
Incorporated azure-quantum-python functions
warren-jones 1ca2709
Adding a SAS token to the storage container URL
warren-jones 2bdf773
Moved an import statement from _storage.py to job.py
warren-jones 1d06fd9
Fixed style check violations
warren-jones 1983073
Deleted an extraneous comment
warren-jones 7bb57e3
Added a unit test
warren-jones 1a105cc
Expanded the unit test
warren-jones 042064b
Made changes to test_submit
warren-jones 703f3e9
Made changes to test_submit
warren-jones b4ef46d
Updated test_provider_sku_list
warren-jones 950a4e0
Added experimental Python SDK code to run a Qiskit input file
warren-jones dc940c1
Added test input files and simplified the job submit code
warren-jones 50cee37
Rearranged the submit code to use old param validation
warren-jones b85a23f
Got it working with imported Python SDK methods
warren-jones 5d71981
Un-did changes to _storage.py and _client_factory.py
warren-jones 941ef50
Fixed Pylint rule violations
warren-jones 9101d4e
Experimenting with ways to suppress the expected azure.identity Crede…
warren-jones be59ec2
Deleted unused import statements
warren-jones 3733adc
Copied azure-quantum-python files to the CLI repo
warren-jones a282256
Added missing SDK files and fixed another import
warren-jones c00aa7c
Added the azure.identity files to vendored_sdks
warren-jones 1ef8c76
Fixed another azure.identity import
warren-jones 40af901
Deleted a commented-out line
warren-jones 3fc5f02
Moved the azure-quantum-python files to the vendored_sdks folder
warren-jones 31cca14
Deleted commented-out lines
warren-jones 5556f1b
Removed 'microsoft.qc' from the default test provider/SKU list and re…
warren-jones 0ad93b0
Made test changes like in branch 29126-remove-resource-estimator-refe…
warren-jones 2924b1c
Resolved merge conflict in test_quantum_jobs.py
warren-jones 643eb4a
Add '.dev3' suffix to version number for final testing
warren-jones cd9535d
Merged changes from main and resolved conflict
warren-jones 3663787
Remove '.dev3' from the version numbers
warren-jones File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/quantum/azext_quantum/vendored_sdks/azure_identity/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # ------------------------------------ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
| # ------------------------------------ | ||
| """Credentials for Azure SDK clients.""" | ||
|
|
||
| from ._auth_record import AuthenticationRecord | ||
| from ._exceptions import AuthenticationRequiredError, CredentialUnavailableError | ||
| from ._constants import AzureAuthorityHosts, KnownAuthorities | ||
| from ._credentials import ( | ||
| AuthorizationCodeCredential, | ||
| AzureDeveloperCliCredential, | ||
| AzureCliCredential, | ||
| AzurePowerShellCredential, | ||
| CertificateCredential, | ||
| ChainedTokenCredential, | ||
| ClientAssertionCredential, | ||
| ClientSecretCredential, | ||
| DefaultAzureCredential, | ||
| DeviceCodeCredential, | ||
| EnvironmentCredential, | ||
| InteractiveBrowserCredential, | ||
| ManagedIdentityCredential, | ||
| OnBehalfOfCredential, | ||
| SharedTokenCacheCredential, | ||
| UsernamePasswordCredential, | ||
| VisualStudioCodeCredential, | ||
| WorkloadIdentityCredential, | ||
| AzurePipelinesCredential, | ||
| ) | ||
| from ._persistent_cache import TokenCachePersistenceOptions | ||
| from ._bearer_token_provider import get_bearer_token_provider | ||
|
|
||
|
|
||
| __all__ = [ | ||
| "AuthenticationRecord", | ||
| "AuthenticationRequiredError", | ||
| "AuthorizationCodeCredential", | ||
| "AzureAuthorityHosts", | ||
| "AzureCliCredential", | ||
| "AzureDeveloperCliCredential", | ||
| "AzurePipelinesCredential", | ||
| "AzurePowerShellCredential", | ||
| "CertificateCredential", | ||
| "ChainedTokenCredential", | ||
| "ClientAssertionCredential", | ||
| "ClientSecretCredential", | ||
| "CredentialUnavailableError", | ||
| "DefaultAzureCredential", | ||
| "DeviceCodeCredential", | ||
| "EnvironmentCredential", | ||
| "InteractiveBrowserCredential", | ||
| "KnownAuthorities", | ||
| "OnBehalfOfCredential", | ||
| "ManagedIdentityCredential", | ||
| "SharedTokenCacheCredential", | ||
| "TokenCachePersistenceOptions", | ||
| "UsernamePasswordCredential", | ||
| "VisualStudioCodeCredential", | ||
| "WorkloadIdentityCredential", | ||
| "get_bearer_token_provider", | ||
| ] | ||
|
|
||
| from ._version import VERSION | ||
|
|
||
| __version__ = VERSION |
114 changes: 114 additions & 0 deletions
114
src/quantum/azext_quantum/vendored_sdks/azure_identity/_auth_record.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # ------------------------------------ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
| # ------------------------------------ | ||
| import json | ||
|
|
||
|
|
||
| SUPPORTED_VERSIONS = {"1.0"} | ||
|
|
||
|
|
||
| class AuthenticationRecord: | ||
| """Non-secret account information for an authenticated user | ||
|
|
||
| This class enables :class:`DeviceCodeCredential` and :class:`InteractiveBrowserCredential` to access | ||
| previously cached authentication data. Applications shouldn't construct instances of this class. They should | ||
| instead acquire one from a credential's **authenticate** method, such as | ||
| :func:`InteractiveBrowserCredential.authenticate`. See the user_authentication sample for more details. | ||
|
|
||
| :param str tenant_id: The tenant the account should authenticate in. | ||
| :param str client_id: The client ID of the application which performed the original authentication. | ||
| :param str authority: The authority host used to authenticate the account. | ||
| :param str home_account_id: A unique identifier of the account. | ||
| :param str username: The user principal or service principal name of the account. | ||
| """ | ||
|
|
||
| def __init__(self, tenant_id: str, client_id: str, authority: str, home_account_id: str, username: str) -> None: | ||
| self._authority = authority | ||
| self._client_id = client_id | ||
| self._home_account_id = home_account_id | ||
| self._tenant_id = tenant_id | ||
| self._username = username | ||
|
|
||
| @property | ||
| def authority(self) -> str: | ||
| """The authority host used to authenticate the account. | ||
|
|
||
| :rtype: str | ||
| """ | ||
| return self._authority | ||
|
|
||
| @property | ||
| def client_id(self) -> str: | ||
| """The client ID of the application which performed the original authentication. | ||
|
|
||
| :rtype: str | ||
| """ | ||
| return self._client_id | ||
|
|
||
| @property | ||
| def home_account_id(self) -> str: | ||
| """A unique identifier of the account. | ||
|
|
||
| :rtype: str | ||
| """ | ||
| return self._home_account_id | ||
|
|
||
| @property | ||
| def tenant_id(self) -> str: | ||
| """The tenant the account should authenticate in. | ||
|
|
||
| :rtype: str | ||
| """ | ||
| return self._tenant_id | ||
|
|
||
| @property | ||
| def username(self) -> str: | ||
| """The user principal or service principal name of the account. | ||
|
|
||
| :rtype: str | ||
| """ | ||
| return self._username | ||
|
|
||
| @classmethod | ||
| def deserialize(cls, data: str) -> "AuthenticationRecord": | ||
| """Deserialize a record. | ||
|
|
||
| :param str data: A serialized record. | ||
| :return: The deserialized record. | ||
| :rtype: ~azure.identity.AuthenticationRecord | ||
| """ | ||
|
|
||
| deserialized = json.loads(data) | ||
|
|
||
| version = deserialized.get("version") | ||
| if version not in SUPPORTED_VERSIONS: | ||
| raise ValueError( | ||
| 'Unexpected version "{}". This package supports these versions: {}'.format(version, SUPPORTED_VERSIONS) | ||
| ) | ||
|
|
||
| return cls( | ||
| authority=deserialized["authority"], | ||
| client_id=deserialized["clientId"], | ||
| home_account_id=deserialized["homeAccountId"], | ||
| tenant_id=deserialized["tenantId"], | ||
| username=deserialized["username"], | ||
| ) | ||
|
|
||
| def serialize(self) -> str: | ||
| """Serialize the record. | ||
|
|
||
| :return: The serialized record. | ||
| :rtype: str | ||
| """ | ||
|
|
||
| record = { | ||
| "authority": self._authority, | ||
| "clientId": self._client_id, | ||
| "homeAccountId": self._home_account_id, | ||
| "tenantId": self._tenant_id, | ||
| "username": self._username, | ||
| "version": "1.0", | ||
| } | ||
|
|
||
| return json.dumps(record) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.