diff --git a/src/azure-cli/azure/cli/command_modules/vm/_params.py b/src/azure-cli/azure/cli/command_modules/vm/_params.py index 3afee9e43a7..45019690c4e 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_params.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_params.py @@ -189,6 +189,7 @@ def load_arguments(self, _): c.argument('security_type', arg_type=get_enum_type(self.get_models('DiskSecurityTypes', operation_group='disks')), help='The security type of the VM. Applicable for OS disks only.', min_api='2020-12-01') c.argument('support_hibernation', arg_type=get_three_state_flag(), help='Indicate the OS on a disk supports hibernation.', min_api='2020-12-01') c.argument('architecture', arg_type=get_enum_type(self.get_models('Architecture', operation_group='disks')), min_api='2021-12-01', help='CPU architecture.') + c.argument('data_access_auth_mode', arg_type=get_enum_type(['AzureActiveDirectory', 'None']), min_api='2021-12-01', help='Specify the auth mode when exporting or uploading to a disk or snapshot.') # endregion # region Snapshots diff --git a/src/azure-cli/azure/cli/command_modules/vm/custom.py b/src/azure-cli/azure/cli/command_modules/vm/custom.py index baa3865d866..054c56dbc65 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/custom.py +++ b/src/azure-cli/azure/cli/command_modules/vm/custom.py @@ -296,7 +296,8 @@ def create_managed_disk(cmd, resource_group_name, disk_name, location=None, # p gallery_image_reference=None, gallery_image_reference_lun=None, network_access_policy=None, disk_access=None, logical_sector_size=None, tier=None, enable_bursting=None, edge_zone=None, security_type=None, support_hibernation=None, - public_network_access=None, accelerated_network=None, architecture=None): + public_network_access=None, accelerated_network=None, architecture=None, + data_access_auth_mode=None): from msrestazure.tools import resource_id, is_valid_resource_id from azure.cli.core.commands.client_factory import get_subscription_id @@ -416,6 +417,8 @@ def create_managed_disk(cmd, resource_group_name, disk_name, location=None, # p else: disk.supported_capabilities.accelerated_network = accelerated_network disk.supported_capabilities.architecture = architecture + if data_access_auth_mode is not None: + disk.data_access_auth_mode = data_access_auth_mode client = _compute_client_factory(cmd.cli_ctx) return sdk_no_wait(no_wait, client.disks.begin_create_or_update, resource_group_name, disk_name, disk) @@ -437,7 +440,7 @@ def update_managed_disk(cmd, resource_group_name, instance, size_gb=None, sku=No disk_mbps_read_write=None, encryption_type=None, disk_encryption_set=None, network_access_policy=None, disk_access=None, max_shares=None, disk_iops_read_only=None, disk_mbps_read_only=None, enable_bursting=None, public_network_access=None, - accelerated_network=None, architecture=None): + accelerated_network=None, architecture=None, data_access_auth_mode=None): from msrestazure.tools import resource_id, is_valid_resource_id from azure.cli.core.commands.client_factory import get_subscription_id @@ -486,6 +489,8 @@ def update_managed_disk(cmd, resource_group_name, instance, size_gb=None, sku=No else: instance.supported_capabilities.accelerated_network = accelerated_network instance.supported_capabilities.architecture = architecture + if data_access_auth_mode is not None: + instance.data_access_auth_mode = data_access_auth_mode return instance # endregion diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_disk_data_access_auth_mode.yaml b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_disk_data_access_auth_mode.yaml new file mode 100644 index 00000000000..e99658a828d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_disk_data_access_auth_mode.yaml @@ -0,0 +1,460 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - disk create + Connection: + - keep-alive + ParameterSetName: + - -g -n --size-gb --data-access-auth-mode + User-Agent: + - AZURECLI/2.36.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.8.10 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_disk_data_access_auth_mode_000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001","name":"cli_test_disk_data_access_auth_mode_000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2022-04-26T02:49:37Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '367' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Apr 2022 02:49:45 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "tags": {}, "sku": {"name": "Premium_LRS"}, + "properties": {"hyperVGeneration": "V1", "creationData": {"createOption": "Empty"}, + "diskSizeGB": 10, "dataAccessAuthMode": "AzureActiveDirectory"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - disk create + Connection: + - keep-alive + Content-Length: + - '220' + Content-Type: + - application/json + ParameterSetName: + - -g -n --size-gb --data-access-auth-mode + User-Agent: + - AZURECLI/2.36.0 azsdk-python-azure-mgmt-compute/26.1.0 Python/3.8.10 (Windows-10-10.0.22000-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001/providers/Microsoft.Compute/disks/disk-000002?api-version=2021-12-01 + response: + body: + string: "{\r\n \"name\": \"disk-000002\",\r\n \"location\": \"eastus2euap\",\r\n + \ \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"Premium_LRS\"\r\n },\r\n + \ \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n \"creationData\": + {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 10,\r\n + \ \"dataAccessAuthMode\": \"AzureActiveDirectory\",\r\n \"provisioningState\": + \"Updating\",\r\n \"isArmResource\": true\r\n }\r\n}" + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/DiskOperations/3526aea7-696a-4a94-bdbd-d32f97971f94?p=88376d82-510f-4098-9fed-60d0fb8eb079&api-version=2021-12-01 + cache-control: + - no-cache + content-length: + - '376' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Apr 2022 02:49:52 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/DiskOperations/3526aea7-696a-4a94-bdbd-d32f97971f94?p=88376d82-510f-4098-9fed-60d0fb8eb079&monitor=true&api-version=2021-12-01 + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/CreateUpdateDisks3Min;998,Microsoft.Compute/CreateUpdateDisks30Min;7993 + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - disk create + Connection: + - keep-alive + ParameterSetName: + - -g -n --size-gb --data-access-auth-mode + User-Agent: + - AZURECLI/2.36.0 azsdk-python-azure-mgmt-compute/26.1.0 Python/3.8.10 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/DiskOperations/3526aea7-696a-4a94-bdbd-d32f97971f94?p=88376d82-510f-4098-9fed-60d0fb8eb079&api-version=2021-12-01 + response: + body: + string: "{\r\n \"startTime\": \"2022-04-26T02:49:52.8188054+00:00\",\r\n \"endTime\": + \"2022-04-26T02:49:52.9437839+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"disk-000002\",\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001/providers/Microsoft.Compute/disks/disk-000002\",\r\n + \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus2euap\",\r\n + \ \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"Premium_LRS\",\r\n \"tier\": + \"Premium\"\r\n },\r\n \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n + \ \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n + \ \"diskSizeGB\": 10,\r\n \"diskIOPSReadWrite\": 120,\r\n \"diskMBpsReadWrite\": + 25,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n + \ },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": + \"Enabled\",\r\n \"dataAccessAuthMode\": \"AzureActiveDirectory\",\r\n + \ \"timeCreated\": \"2022-04-26T02:49:52.8188054+00:00\",\r\n \"provisioningState\": + \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": + 10737418240,\r\n \"uniqueId\": \"2cafea8a-5451-4685-9d7a-5085fad5078d\",\r\n + \ \"tier\": \"P3\"\r\n }\r\n}\r\n },\r\n \"name\": \"3526aea7-696a-4a94-bdbd-d32f97971f94\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1222' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Apr 2022 02:49:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;49997,Microsoft.Compute/GetOperation30Min;399989 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - disk create + Connection: + - keep-alive + ParameterSetName: + - -g -n --size-gb --data-access-auth-mode + User-Agent: + - AZURECLI/2.36.0 azsdk-python-azure-mgmt-compute/26.1.0 Python/3.8.10 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001/providers/Microsoft.Compute/disks/disk-000002?api-version=2021-12-01 + response: + body: + string: "{\r\n \"name\": \"disk-000002\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001/providers/Microsoft.Compute/disks/disk-000002\",\r\n + \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus2euap\",\r\n + \ \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"Premium_LRS\",\r\n \"tier\": + \"Premium\"\r\n },\r\n \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n + \ \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n + \ \"diskSizeGB\": 10,\r\n \"diskIOPSReadWrite\": 120,\r\n \"diskMBpsReadWrite\": + 25,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n + \ },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": + \"Enabled\",\r\n \"dataAccessAuthMode\": \"AzureActiveDirectory\",\r\n + \ \"timeCreated\": \"2022-04-26T02:49:52.8188054+00:00\",\r\n \"provisioningState\": + \"Succeeded\",\r\n \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": + 10737418240,\r\n \"uniqueId\": \"2cafea8a-5451-4685-9d7a-5085fad5078d\",\r\n + \ \"tier\": \"P3\"\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '997' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Apr 2022 02:49:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;14995,Microsoft.Compute/LowCostGet30Min;119958 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - disk create + Connection: + - keep-alive + ParameterSetName: + - -g -n --size-gb --data-access-auth-mode + User-Agent: + - AZURECLI/2.36.0 azsdk-python-azure-mgmt-resource/20.0.0 Python/3.8.10 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_disk_data_access_auth_mode_000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001","name":"cli_test_disk_data_access_auth_mode_000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","date":"2022-04-26T02:49:37Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '367' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Apr 2022 02:49:56 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus2euap", "tags": {}, "sku": {"name": "Premium_LRS"}, + "properties": {"hyperVGeneration": "V1", "creationData": {"createOption": "Empty"}, + "diskSizeGB": 10, "dataAccessAuthMode": "None"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - disk create + Connection: + - keep-alive + Content-Length: + - '204' + Content-Type: + - application/json + ParameterSetName: + - -g -n --size-gb --data-access-auth-mode + User-Agent: + - AZURECLI/2.36.0 azsdk-python-azure-mgmt-compute/26.1.0 Python/3.8.10 (Windows-10-10.0.22000-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001/providers/Microsoft.Compute/disks/disk-000003?api-version=2021-12-01 + response: + body: + string: "{\r\n \"name\": \"disk-000003\",\r\n \"location\": \"eastus2euap\",\r\n + \ \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"Premium_LRS\"\r\n },\r\n + \ \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n \"creationData\": + {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 10,\r\n + \ \"dataAccessAuthMode\": \"None\",\r\n \"provisioningState\": \"Updating\",\r\n + \ \"isArmResource\": true\r\n }\r\n}" + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/DiskOperations/975a7ad5-3c67-4518-8685-5c7d6d8ed1e6?p=88376d82-510f-4098-9fed-60d0fb8eb079&api-version=2021-12-01 + cache-control: + - no-cache + content-length: + - '360' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Apr 2022 02:50:00 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/DiskOperations/975a7ad5-3c67-4518-8685-5c7d6d8ed1e6?p=88376d82-510f-4098-9fed-60d0fb8eb079&monitor=true&api-version=2021-12-01 + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/CreateUpdateDisks3Min;998,Microsoft.Compute/CreateUpdateDisks30Min;7994 + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - disk create + Connection: + - keep-alive + ParameterSetName: + - -g -n --size-gb --data-access-auth-mode + User-Agent: + - AZURECLI/2.36.0 azsdk-python-azure-mgmt-compute/26.1.0 Python/3.8.10 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus2euap/DiskOperations/975a7ad5-3c67-4518-8685-5c7d6d8ed1e6?p=88376d82-510f-4098-9fed-60d0fb8eb079&api-version=2021-12-01 + response: + body: + string: "{\r\n \"startTime\": \"2022-04-26T02:50:01.4596684+00:00\",\r\n \"endTime\": + \"2022-04-26T02:50:01.5846912+00:00\",\r\n \"status\": \"Succeeded\",\r\n + \ \"properties\": {\r\n \"output\": {\r\n \"name\": \"disk-000003\",\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001/providers/Microsoft.Compute/disks/disk-000003\",\r\n + \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus2euap\",\r\n + \ \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"Premium_LRS\",\r\n \"tier\": + \"Premium\"\r\n },\r\n \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n + \ \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n + \ \"diskSizeGB\": 10,\r\n \"diskIOPSReadWrite\": 120,\r\n \"diskMBpsReadWrite\": + 25,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n + \ },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": + \"Enabled\",\r\n \"dataAccessAuthMode\": \"None\",\r\n \"timeCreated\": + \"2022-04-26T02:50:01.4596684+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 10737418240,\r\n + \ \"uniqueId\": \"7c3fa29e-da14-4cf4-95a0-1da276197c18\",\r\n \"tier\": + \"P3\"\r\n }\r\n}\r\n },\r\n \"name\": \"975a7ad5-3c67-4518-8685-5c7d6d8ed1e6\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1206' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Apr 2022 02:50:03 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/GetOperation3Min;49997,Microsoft.Compute/GetOperation30Min;399991 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - disk create + Connection: + - keep-alive + ParameterSetName: + - -g -n --size-gb --data-access-auth-mode + User-Agent: + - AZURECLI/2.36.0 azsdk-python-azure-mgmt-compute/26.1.0 Python/3.8.10 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001/providers/Microsoft.Compute/disks/disk-000003?api-version=2021-12-01 + response: + body: + string: "{\r\n \"name\": \"disk-000003\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_data_access_auth_mode_000001/providers/Microsoft.Compute/disks/disk-000003\",\r\n + \ \"type\": \"Microsoft.Compute/disks\",\r\n \"location\": \"eastus2euap\",\r\n + \ \"tags\": {},\r\n \"sku\": {\r\n \"name\": \"Premium_LRS\",\r\n \"tier\": + \"Premium\"\r\n },\r\n \"properties\": {\r\n \"hyperVGeneration\": \"V1\",\r\n + \ \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n + \ \"diskSizeGB\": 10,\r\n \"diskIOPSReadWrite\": 120,\r\n \"diskMBpsReadWrite\": + 25,\r\n \"encryption\": {\r\n \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n + \ },\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"publicNetworkAccess\": + \"Enabled\",\r\n \"dataAccessAuthMode\": \"None\",\r\n \"timeCreated\": + \"2022-04-26T02:50:01.4596684+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 10737418240,\r\n + \ \"uniqueId\": \"7c3fa29e-da14-4cf4-95a0-1da276197c18\",\r\n \"tier\": + \"P3\"\r\n }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '981' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 26 Apr 2022 02:50:03 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-resource: + - Microsoft.Compute/LowCostGet3Min;14995,Microsoft.Compute/LowCostGet30Min;119961 + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py index dbd0c93bcc1..b936b9636e9 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py @@ -7086,6 +7086,19 @@ def test_disk_hibernation(self): self.check('supportsHibernation', True) ]) + @ResourceGroupPreparer(name_prefix='cli_test_disk_data_access_auth_mode_', location='eastus2euap') + def test_disk_data_access_auth_mode(self): + self.kwargs.update({ + 'disk': self.create_random_name('disk-', 10), + 'disk1': self.create_random_name('disk-', 10) + }) + self.cmd('disk create -g {rg} -n {disk} --size-gb 10 --data-access-auth-mode AzureActiveDirectory', checks=[ + self.check('dataAccessAuthMode', 'AzureActiveDirectory') + ]) + self.cmd('disk create -g {rg} -n {disk1} --size-gb 10 --data-access-auth-mode None', checks=[ + self.check('dataAccessAuthMode', 'None') + ]) + class VMCreateCountScenarioTest(ScenarioTest): @AllowLargeResponse()