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
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ class Clients(str, Enum):
ResourceType.DATA_KEYVAULT_SECRETS:
'azure.keyvault.secrets._client#SecretClient{obj_name}',
ResourceType.DATA_KEYVAULT_SECURITY_DOMAIN:
'azure.cli.command_modules.keyvault.vendored_sdks.azure_keyvault_securitydomain.'
'_patch#SecurityDomainClient{obj_name}',
'azure.keyvault.securitydomain._client#SecurityDomainClient{obj_name}',
}


Expand Down Expand Up @@ -241,7 +240,7 @@ def data_plane_azure_keyvault_secret_client(cli_ctx, command_args):


def data_plane_azure_keyvault_security_domain_client(cli_ctx, command_args):
from azure.cli.command_modules.keyvault.vendored_sdks.azure_keyvault_securitydomain import SecurityDomainClient
from azure.keyvault.securitydomain import SecurityDomainClient
vault_url, credential, _ = _prepare_data_plane_azure_keyvault_client(
cli_ctx, command_args, ResourceType.DATA_KEYVAULT_SECURITY_DOMAIN)
command_args.pop('hsm_name', None)
Expand Down
10 changes: 5 additions & 5 deletions src/azure-cli/azure/cli/command_modules/keyvault/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2310,9 +2310,9 @@ def _security_domain_restore_blob(sd_file, sd_exchange_key, sd_wrapping_keys, pa

def _security_domain_upload_blob(client, restore_blob_value, no_wait=False):
security_domain = {'value': restore_blob_value}
poller = client.begin_upload(security_domain=security_domain, polling=not no_wait)
if not no_wait:
return poller.result()
poller = client.begin_upload(security_domain=security_domain, skip_activation_polling=no_wait)
poller.result()
return client.get_upload_status()


def security_domain_upload(client, sd_file, restore_blob=False, sd_exchange_key=None,
Expand Down Expand Up @@ -2392,12 +2392,12 @@ def _save_to_local_file(file_path, security_domain):
raise FileOperationError(str(ex))

certificate_info = {'certificates': certificates, 'required': sd_quorum}
poller = client.begin_download(certificate_info_object=certificate_info, polling=not no_wait)
poller = client.begin_download(certificate_info=certificate_info, skip_activation_polling=no_wait)
security_domain = poller.result()
if poller.status() != 'Failed':
_save_to_local_file(security_domain_file, security_domain)
if not no_wait:
return _wait_security_domain_operation(client, 'download')
return client.get_download_status()


def check_name_availability(cmd, client, name, resource_type='hsm'):
Expand Down
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't successfully re-record this test because of service maintenance:

(UnavailableDueToMaintenance) This security domain cannot be restored at this time due to necessary service maintenance. For more information, please see https://aka.ms/mhsm/planned-maintenance.

So here I manually updated the yaml file to make test pass

Original file line number Diff line number Diff line change
Expand Up @@ -7050,6 +7050,54 @@ interactions:
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
CommandName:
- keyvault security-domain upload
Connection:
- keep-alive
ParameterSetName:
- --hsm-name --sd-file --sd-exchange-key --sd-wrapping-keys
User-Agent:
- AZURECLI/2.71.0 azsdk-python-core/1.31.0 Python/3.11.9 (Windows-10-10.0.26100-SP0)
method: GET
uri: https://test-mhsm-sd2000003.managedhsm.azure.net/securitydomain/upload/pending?api-version=7.5
response:
body:
string: '{"status":"Success","status_details":"The resource is active."}'
headers:
azure-asyncoperation:
- https://test-mhsm-sd2000003.managedhsm.azure.net/securitydomain/upload/pending?api-version=7.5
cache-control:
- no-cache
content-length:
- '63'
content-security-policy:
- default-src 'self'
content-type:
- application/json; charset=utf-8
strict-transport-security:
- max-age=31536000; includeSubDomains
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-ms-build-version:
- 1.0.20250221-1-e4accbbe-develop
x-ms-keyvault-network-info:
- conn_type=Ipv4;addr=167.220.255.108;act_addr_fam=Ipv4;
x-ms-keyvault-region:
- canadaeast
x-ms-server-latency:
- '0'
status:
code: 200
message: OK
- request:
body: null
headers:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading