{Keyvault} az keyvault security-domain: Migrate security domain to use track2 SDK#30252
{Keyvault} az keyvault security-domain: Migrate security domain to use track2 SDK#30252
az keyvault security-domain: Migrate security domain to use track2 SDK#30252Conversation
️✔️AzureCLI-FullTest
|
|
Hi @evelyn-ys, |
️✔️AzureCLI-BreakingChangeTest
|
|
Migrate security domain to use track2 SDK |
| ResourceType.DATA_KEYVAULT_CERTIFICATES: None, | ||
| ResourceType.DATA_KEYVAULT_KEYS: None, | ||
| ResourceType.DATA_KEYVAULT_SECRETS: None, | ||
| ResourceType.DATA_KEYVAULT: '2016-10-01', |
There was a problem hiding this comment.
security-domain is never supported in Azure Stack. But key/secret/certificate are supported so we have DATA_KEYVAULT_KEYS/DATA_KEYVAULT_SECRETS/DATA_KEYVAULT_CERTIFICATES definition in azure stack
| ret = { | ||
| 'status': getattr(result, 'status', None), | ||
| 'statusDetails': getattr(result, 'status_details', None) | ||
| } |
There was a problem hiding this comment.
Why not rely on knack's serialization?
There was a problem hiding this comment.
Because SDK use a strange ModelBase which can't be serialized by knack
| vault_url, credential, version = _prepare_data_plane_azure_keyvault_client( | ||
| cli_ctx, command_args, ResourceType.DATA_KEYVAULT_ADMINISTRATION_ACCESS_CONTROL) | ||
| client_kwargs = prepare_client_kwargs_track2(cli_ctx) | ||
| client_kwargs.pop('http_logging_policy') |
There was a problem hiding this comment.
Is this because this SDK doesn't support http_logging_policy?
There was a problem hiding this comment.
Keyvault data plane SDKs have fixed http_logging_policy and don't accept customization
| c.extra('hsm_name', hsm_url_type, required=False, | ||
| help='Name of the HSM. Can be omitted if --id is specified.') |
There was a problem hiding this comment.
If hsm_name is now an "extra" argument, how can it be used to create the SDK client?
There was a problem hiding this comment.
It's now accepted when creating client in client_factory.py instead of calling sdk in custom.py
| sd_jwk['x5c'] = [Utils.security_domain_b64_url_encode_for_x5c(public_bytes)] # only one cert, not a chain | ||
| sd_jwk['x5t'] = Utils.security_domain_b64_url_encode(hashlib.sha1(public_bytes).digest()) | ||
| sd_jwk['x5t#S256'] = Utils.security_domain_b64_url_encode(hashlib.sha256(public_bytes).digest()) | ||
| sd_jwk['key_ops'] = ['verify', 'encrypt', 'wrapKey'] |
There was a problem hiding this comment.
Does Track 2 SDK now require dict instead of an SDK object?
There was a problem hiding this comment.
Track2 SDK can accept both model object and dict. I don't want to import many models from SDK so here use simple dict
Related command
az keyvault security-domainDescription
Pending SDK release Azure/azure-sdk-for-python#37929
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.