azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Support changes for ConfidentialVMv2

Open linuxelf001 opened this issue 1 year ago • 8 comments

Preconditions

  • [x] No need to upgrade Python SDK or the Python SDK is ready.

Related command

az disk create az disk grant-access

Resource Provider

Microsoft.Compute/disks, Microsoft.Compute/snapshots

Description of Feature or Work Requested

Feature request to add output value, new parameter for following commands to support Confidential VM OS Disks

az disk create az disk grant-access

Feature request is to provide customers with Confidential VM disk management:

Import managed OS disk for Confidential VM with an additional attribute in the request - securityMetadataUri Export managed OS disk for Confidential VM returns an additional attribute in the response - securityMetadataAccessSAS

  1. az disk create

    New Parameter --security-metadata-uri New string parameter --security-metadata-uri for command az disk create:

    Allows customer to pass Blob URI for VM Metadata VHD. When specified, the command should interpret that disk will be imported from un-managed VHD in storage account or another managed disk for Confidential VM OS Disk Security Type. This is the URI of a blob to be imported into VM metadata.

  2. az disk grant-access

    Output would show additional securityMetadataAccessSAS in response.

Examples:

  1. Secure Import of Confidential VM OS Disk Create disk with --security-metadata-uri parameter:

    az disk create -n $diskName -g $resourceGroup
    -l $location --os-type Windows --hyper-v-generation V2
    --security-type "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"
    --source $sourceDiskVhdUri --security-data-uri $guestStateDiskVhdUri --security-metadata-uri $metadataDiskVhdUri \ --sku standard_lrs

  2. Export of Confidential VM OS Disk

    Grant access to generate accessSas, securityDataAccessSAS, securityMetadataAccessSAS using --secure-vm-guest-state-sas parameter

    diskSas = $(az disk grant-access -n $diskName -g $resourceGroupName
    --access-level Write --duration-in-seconds 86400
    --secure-vm-guest-state-sas)

    Returned value schema:

     {
        "accessSas": "https://md-impexp-t0rdsfgsdfg4.blob.core.windows.net/w2c3mj0ksfgl/abcd?sv=2017-04-17&sr=b&si=600a9281-d39e-4cc3-91d2-923c4a696537&sig=xXaT6mFgf139ycT87CADyFxb%2BnPXBElYirYRlbnJZbs%3D",
         "securityDataAccessSAS": "VM Guest State Sas URI"
         "securityMetadataAccessSAS": "VM Metadata Sas URI"
       }
    

Minimum API Version Required

2025-01-02

Swagger PR link / SDK link

https://github.com/Azure/azure-rest-api-specs/pull/35011

Request Example

No response

Target Date

2025-09-02

PM Contact

raginjup, geg, runcai

Engineer Contact

aayushkher, raharwadekar

Additional context

No response

linuxelf001 avatar Jul 28 '25 15:07 linuxelf001

Thank you for opening this issue, we will look into it.

yonzhan avatar Jul 28 '25 15:07 yonzhan

Here are some similar issues that might help you. Please check if they can solve your problem.

  • #22275
  • #22200

Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)

Solution 1:

I suggest that users use --secure-vm-guest-state-sas to indicate query securityDataAccessSAS instead of --secure-vm-guest-state-sas True, because there is no case for --secure-vm-guest-state-sas False, so the user's input should be simplified.

Reference:

  • https://github.com/azure/azure-cli/issues/22275#issuecomment-1141599244

Solution 2:

CLI will query disk resources created using az disk create command and if --for-upload is set to secureOsUpload then --secure-vm-guest-state-sas switch will be auto-added in az disk grant-access command. Additionally, --for-upload parameter will continue to support true as alias for nonSecureOsUpload with warning message that true will be deprecated in future and preferably with link where end users can read about difference between secureOsUpload and nonSecureOsUpload.

Reference:

  • https://github.com/azure/azure-cli/issues/22275#issuecomment-1141795493

Solution 3:

For parameter --secure-vm-guest-state-sas, if we can publish example in docs on how to use the returned VM Guest State SAS URL for uploading disk with security data, that'll be helpful.

Reference:

  • https://github.com/azure/azure-cli/issues/22275#issuecomment-1168187254

Powered by issue-sentinel

github-actions[bot] avatar Jul 28 '25 15:07 github-actions[bot]

@linuxelf001 May I ask if this is a new feature request? If so, since the release date of our next sprint is 09-02, so can we set the ETA for this feature request to 09-02?

zhoxing-ms avatar Jul 29 '25 04:07 zhoxing-ms

@zhoxing-ms - Thanks for the update. Is it possible to target these changes in the current sprint?

linuxelf001 avatar Jul 29 '25 13:07 linuxelf001

Thanks for the update. Is it possible to target these changes in the current sprint?

@linuxelf001 Sorry, the code freeze date for this sprint ended yesterday, so 09-02 is already our latest and fastest release date

zhoxing-ms avatar Jul 30 '25 02:07 zhoxing-ms

Thanks @zhoxing-ms for the confirmation. If there are any questions, please let me know.

linuxelf001 avatar Aug 06 '25 17:08 linuxelf001

Hi @linuxelf001 After upgrading the API version to 2025-01-02, the additional property securityMetadataAccessSAS still does not appear in the response of the az disk grant-access command. Could you please help to look at it? Thanks! Here's the request details:

msal.telemetry: Generate or reuse correlation_id: 0170d39e-c185-48e4-93b0-3370e6993b82
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/6030fb9a-6ed7-4414-b379-afd558a954e6/resourceGroups/zytest/providers/Microsoft.Compute/disks/disk1/beginGetAccess?api-version=2025-01-02'
cli.azure.cli.core.sdk.policies: Request method: 'POST'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'Content-Length': '81'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '863ce7b3-773c-11f0-b258-6045bde75e47'
cli.azure.cli.core.sdk.policies:     'CommandName': 'disk grant-access'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '-n -g --access-level --duration-in-seconds --secure-vm-guest-state-sas --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.76.0 (PIP) azsdk-python-core/1.35.0 Python/3.11.9 (Windows-10-10.0.26100-SP0)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"access": "Write", "durationInSeconds": 86400, "getSecureVMGuestStateSAS": true}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions/6030fb9a-6ed7-4414-b379-afd558a954e6/resourceGroups/zytest/providers/Microsoft.Compute/disks/disk1/beginGetAccess?api-version=2025-01-02 HTTP/1.1" 202 0
cli.azure.cli.core.sdk.policies: Response status: 202

yanzhudd avatar Aug 12 '25 05:08 yanzhudd

Hi @yanzhudd , as per the disk creation logs the test disk "disk1" has been created with Trusted launch security type which will not have vmmd blob to generate securityMetadataAccessSAS. Since this change request is only for ConfidentialVM disks, so please create a disk with confidentialvm security type in eastus2euap for testing.

aayushkher avatar Aug 13 '25 02:08 aayushkher