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 51dd2167921..bc73c6dffe2 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/custom.py +++ b/src/azure-cli/azure/cli/command_modules/vm/custom.py @@ -1065,15 +1065,16 @@ def auto_shutdown_vm(cmd, resource_group_name, vm_name, off=None, email=None, we raise CLIError('usage error: --time is a required parameter') daily_recurrence = {'time': time} notification_settings = None - if email and not webhook: - raise CLIError('usage error: --webhook is a required parameter when --email exists') - if webhook: + if email or webhook: notification_settings = { - 'emailRecipient': email, - 'webhookUrl': webhook, 'timeInMinutes': 30, 'status': 'Enabled' } + if email: + notification_settings['emailRecipient'] = email + if webhook: + notification_settings['webhookUrl'] = webhook + schedule = Schedule(status='Enabled', target_resource_id=vm_id, daily_recurrence=daily_recurrence, diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_auto_shutdown.yaml b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_auto_shutdown.yaml index 3a7ceff2bb8..015e0e793ee 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_auto_shutdown.yaml +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_auto_shutdown.yaml @@ -13,12 +13,12 @@ interactions: ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/16.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001","name":"cli_test_vm_auto_shutdown000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-05-25T06:20:24Z"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001","name":"cli_test_vm_auto_shutdown000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-07-29T10:00:20Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -27,7 +27,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:20:26 GMT + - Thu, 29 Jul 2021 10:01:41 GMT expires: - '-1' pragma: @@ -51,7 +51,7 @@ interactions: Connection: - keep-alive User-Agent: - - python-requests/2.25.1 + - python-requests/2.26.0 method: GET uri: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json response: @@ -62,34 +62,35 @@ interactions: \"object\",\n \"value\": {\n \"Linux\": {\n \"CentOS\": {\n \"publisher\": \"OpenLogic\",\n \"offer\": \"CentOS\",\n \ \"sku\": \"7.5\",\n \"version\": \"latest\"\n },\n - \ \"CoreOS\": {\n \"publisher\": \"CoreOS\",\n \"offer\": - \"CoreOS\",\n \"sku\": \"Stable\",\n \"version\": \"latest\"\n - \ },\n \"Debian\": {\n \"publisher\": \"Debian\",\n - \ \"offer\": \"debian-10\",\n \"sku\": \"10\",\n \"version\": - \"latest\"\n },\n \"openSUSE-Leap\": {\n \"publisher\": - \"SUSE\",\n \"offer\": \"openSUSE-Leap\",\n \"sku\": - \"42.3\",\n \"version\": \"latest\"\n },\n \"RHEL\": - {\n \"publisher\": \"RedHat\",\n \"offer\": \"RHEL\",\n - \ \"sku\": \"7-LVM\",\n \"version\": \"latest\"\n },\n - \ \"SLES\": {\n \"publisher\": \"SUSE\",\n \"offer\": - \"SLES\",\n \"sku\": \"15\",\n \"version\": \"latest\"\n - \ },\n \"UbuntuLTS\": {\n \"publisher\": \"Canonical\",\n - \ \"offer\": \"UbuntuServer\",\n \"sku\": \"18.04-LTS\",\n - \ \"version\": \"latest\"\n }\n },\n \"Windows\": - {\n \"Win2019Datacenter\": {\n \"publisher\": \"MicrosoftWindowsServer\",\n - \ \"offer\": \"WindowsServer\",\n \"sku\": \"2019-Datacenter\",\n - \ \"version\": \"latest\"\n },\n \"Win2016Datacenter\": - {\n \"publisher\": \"MicrosoftWindowsServer\",\n \"offer\": - \"WindowsServer\",\n \"sku\": \"2016-Datacenter\",\n \"version\": - \"latest\"\n },\n \"Win2012R2Datacenter\": {\n \"publisher\": + \ \"Debian\": {\n \"publisher\": \"Debian\",\n \"offer\": + \"debian-10\",\n \"sku\": \"10\",\n \"version\": \"latest\"\n + \ },\n \"Flatcar\": {\n \"publisher\": \"kinvolk\",\n + \ \"offer\": \"flatcar-container-linux-free\",\n \"sku\": + \"stable\",\n \"version\": \"latest\"\n },\n \"openSUSE-Leap\": + {\n \"publisher\": \"SUSE\",\n \"offer\": \"openSUSE-Leap\",\n + \ \"sku\": \"42.3\",\n \"version\": \"latest\"\n },\n + \ \"RHEL\": {\n \"publisher\": \"RedHat\",\n \"offer\": + \"RHEL\",\n \"sku\": \"7-LVM\",\n \"version\": \"latest\"\n + \ },\n \"SLES\": {\n \"publisher\": \"SUSE\",\n + \ \"offer\": \"SLES\",\n \"sku\": \"15\",\n \"version\": + \"latest\"\n },\n \"UbuntuLTS\": {\n \"publisher\": + \"Canonical\",\n \"offer\": \"UbuntuServer\",\n \"sku\": + \"18.04-LTS\",\n \"version\": \"latest\"\n }\n },\n + \ \"Windows\": {\n \"Win2019Datacenter\": {\n \"publisher\": \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": - \"2012-R2-Datacenter\",\n \"version\": \"latest\"\n },\n - \ \"Win2012Datacenter\": {\n \"publisher\": \"MicrosoftWindowsServer\",\n - \ \"offer\": \"WindowsServer\",\n \"sku\": \"2012-Datacenter\",\n - \ \"version\": \"latest\"\n },\n \"Win2008R2SP1\": + \"2019-Datacenter\",\n \"version\": \"latest\"\n },\n + \ \"Win2016Datacenter\": {\n \"publisher\": \"MicrosoftWindowsServer\",\n + \ \"offer\": \"WindowsServer\",\n \"sku\": \"2016-Datacenter\",\n + \ \"version\": \"latest\"\n },\n \"Win2012R2Datacenter\": {\n \"publisher\": \"MicrosoftWindowsServer\",\n \"offer\": - \"WindowsServer\",\n \"sku\": \"2008-R2-SP1\",\n \"version\": - \"latest\"\n }\n }\n }\n }\n }\n}\n" + \"WindowsServer\",\n \"sku\": \"2012-R2-Datacenter\",\n \"version\": + \"latest\"\n },\n \"Win2012Datacenter\": {\n \"publisher\": + \"MicrosoftWindowsServer\",\n \"offer\": \"WindowsServer\",\n \"sku\": + \"2012-Datacenter\",\n \"version\": \"latest\"\n },\n + \ \"Win2008R2SP1\": {\n \"publisher\": \"MicrosoftWindowsServer\",\n + \ \"offer\": \"WindowsServer\",\n \"sku\": \"2008-R2-SP1\",\n + \ \"version\": \"latest\"\n }\n }\n }\n }\n + \ }\n}\n" headers: accept-ranges: - bytes @@ -100,19 +101,19 @@ interactions: connection: - keep-alive content-length: - - '2501' + - '2525' content-security-policy: - default-src 'none'; style-src 'unsafe-inline'; sandbox content-type: - text/plain; charset=utf-8 date: - - Tue, 25 May 2021 06:20:27 GMT + - Thu, 29 Jul 2021 10:01:42 GMT etag: - - W/"540044b4084c3c314537f1baa1770f248628b2bc9ba0328f1004c33862e049da" + - W/"54bceef15b892f2aa7f4c2145a49f1b5e33608722acdbb47933d7b6cbebbd7f4" expires: - - Tue, 25 May 2021 06:25:27 GMT + - Thu, 29 Jul 2021 10:06:42 GMT source-age: - - '228' + - '0' strict-transport-security: - max-age=31536000 vary: @@ -126,15 +127,15 @@ interactions: x-content-type-options: - nosniff x-fastly-request-id: - - 459986f779e79eff84c2f100111a7e6cb1a29840 + - 9a9da9f1ae8b190203315133e5c968fb325c6fa3 x-frame-options: - deny x-github-request-id: - - 76E4:7B19:1861EF:259B1D:60AA60F7 + - D1BC:1611:2E1148:350A45:61026FB4 x-served-by: - - cache-qpg1254-QPG + - cache-hkg17927-HKG x-timer: - - S1621923627.168456,VS0,VE0 + - S1627552902.278165,VS0,VE256 x-xss-protection: - 1; mode=block status: @@ -154,7 +155,7 @@ interactions: ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-network/18.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/virtualNetworks?api-version=2018-01-01 response: @@ -168,7 +169,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:20:27 GMT + - Thu, 29 Jul 2021 10:01:42 GMT expires: - '-1' pragma: @@ -203,13 +204,13 @@ interactions: {"apiVersion": "2021-03-01", "type": "Microsoft.Compute/virtualMachines", "name": "vm1", "location": "westus", "tags": {}, "dependsOn": ["Microsoft.Network/networkInterfaces/vm1VMNic"], "properties": {"hardwareProfile": {"vmSize": "Standard_DS1_v2"}, "networkProfile": - {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic"}]}, - "storageProfile": {"osDisk": {"createOption": "fromImage", "name": null, "caching": - "ReadWrite", "managedDisk": {"storageAccountType": null}}, "imageReference": - {"publisher": "OpenLogic", "offer": "CentOS", "sku": "7.5", "version": "latest"}}, - "osProfile": {"computerName": "vm1", "adminUsername": "azureuser", "adminPassword": - "[parameters(''adminPassword'')]"}}}], "outputs": {}}, "parameters": {"adminPassword": - {"value": "testPassword0"}}, "mode": "incremental"}}' + {"networkInterfaces": [{"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic", + "properties": {"deleteOption": null}}]}, "storageProfile": {"osDisk": {"createOption": + "fromImage", "name": null, "caching": "ReadWrite", "managedDisk": {"storageAccountType": + null}}, "imageReference": {"publisher": "OpenLogic", "offer": "CentOS", "sku": + "7.5", "version": "latest"}}, "osProfile": {"computerName": "vm1", "adminUsername": + "azureuser", "adminPassword": "[parameters(''adminPassword'')]"}}}], "outputs": + {}}, "parameters": {"adminPassword": {"value": "testPassword0"}}, "mode": "incremental"}}' headers: Accept: - application/json @@ -220,29 +221,29 @@ interactions: Connection: - keep-alive Content-Length: - - '3024' + - '3062' Content-Type: - application/json ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/16.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/vm_deploy_8ChYipa962WCz0GS14OUZcaElzpRqcmO","name":"vm_deploy_8ChYipa962WCz0GS14OUZcaElzpRqcmO","type":"Microsoft.Resources/deployments","properties":{"templateHash":"15929483597185680016","parameters":{"adminPassword":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2021-05-25T06:20:31.3383818Z","duration":"PT2.1409923S","correlationId":"2694362d-e3a5-4050-b102-ede4f2d2d6d4","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}]}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/vm_deploy_040TNorlExDFO1N9sKoJqOSJhVym3bRC","name":"vm_deploy_040TNorlExDFO1N9sKoJqOSJhVym3bRC","type":"Microsoft.Resources/deployments","properties":{"templateHash":"2463088675896759551","parameters":{"adminPassword":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2021-07-29T10:01:47.8010733Z","duration":"PT2.2634311S","correlationId":"47365f58-3180-4472-8636-cb8aba11605e","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}]}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/vm_deploy_8ChYipa962WCz0GS14OUZcaElzpRqcmO/operationStatuses/08585796832562802439?api-version=2021-04-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/vm_deploy_040TNorlExDFO1N9sKoJqOSJhVym3bRC/operationStatuses/08585740539799399900?api-version=2021-04-01 cache-control: - no-cache content-length: - - '2782' + - '2781' content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:20:32 GMT + - Thu, 29 Jul 2021 10:01:48 GMT expires: - '-1' pragma: @@ -252,7 +253,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1193' + - '1199' status: code: 201 message: Created @@ -270,9 +271,9 @@ interactions: ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/16.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585796832562802439?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585740539799399900?api-version=2021-04-01 response: body: string: '{"status":"Running"}' @@ -284,7 +285,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:21:02 GMT + - Thu, 29 Jul 2021 10:02:19 GMT expires: - '-1' pragma: @@ -312,9 +313,9 @@ interactions: ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/16.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585796832562802439?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585740539799399900?api-version=2021-04-01 response: body: string: '{"status":"Running"}' @@ -326,7 +327,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:21:33 GMT + - Thu, 29 Jul 2021 10:02:50 GMT expires: - '-1' pragma: @@ -354,9 +355,9 @@ interactions: ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/16.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585796832562802439?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08585740539799399900?api-version=2021-04-01 response: body: string: '{"status":"Succeeded"}' @@ -368,7 +369,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:22:03 GMT + - Thu, 29 Jul 2021 10:03:20 GMT expires: - '-1' pragma: @@ -396,21 +397,21 @@ interactions: ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/16.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/vm_deploy_8ChYipa962WCz0GS14OUZcaElzpRqcmO","name":"vm_deploy_8ChYipa962WCz0GS14OUZcaElzpRqcmO","type":"Microsoft.Resources/deployments","properties":{"templateHash":"15929483597185680016","parameters":{"adminPassword":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2021-05-25T06:22:03.1203682Z","duration":"PT1M33.9229787S","correlationId":"2694362d-e3a5-4050-b102-ede4f2d2d6d4","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}],"outputs":{},"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/virtualNetworks/vm1VNET"}]}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Resources/deployments/vm_deploy_040TNorlExDFO1N9sKoJqOSJhVym3bRC","name":"vm_deploy_040TNorlExDFO1N9sKoJqOSJhVym3bRC","type":"Microsoft.Resources/deployments","properties":{"templateHash":"2463088675896759551","parameters":{"adminPassword":{"type":"SecureString"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2021-07-29T10:03:13.9361729Z","duration":"PT1M28.3985307S","correlationId":"47365f58-3180-4472-8636-cb8aba11605e","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"virtualNetworks","locations":["westus"]},{"resourceType":"networkSecurityGroups","locations":["westus"]},{"resourceType":"publicIPAddresses","locations":["westus"]},{"resourceType":"networkInterfaces","locations":["westus"]}]},{"namespace":"Microsoft.Compute","resourceTypes":[{"resourceType":"virtualMachines","locations":["westus"]}]}],"dependencies":[{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/virtualNetworks/vm1VNET","resourceType":"Microsoft.Network/virtualNetworks","resourceName":"vm1VNET"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG","resourceType":"Microsoft.Network/networkSecurityGroups","resourceName":"vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP","resourceType":"Microsoft.Network/publicIPAddresses","resourceName":"vm1PublicIP"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"},{"dependsOn":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic","resourceType":"Microsoft.Network/networkInterfaces","resourceName":"vm1VMNic"}],"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1","resourceType":"Microsoft.Compute/virtualMachines","resourceName":"vm1"}],"outputs":{},"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/virtualNetworks/vm1VNET"}]}}' headers: cache-control: - no-cache content-length: - - '3849' + - '3848' content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:22:04 GMT + - Thu, 29 Jul 2021 10:03:20 GMT expires: - '-1' pragma: @@ -438,23 +439,23 @@ interactions: ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-compute/21.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-compute/22.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1?$expand=instanceView&api-version=2021-03-01 response: body: string: "{\r\n \"name\": \"vm1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1\",\r\n \ \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"westus\",\r\n - \ \"tags\": {},\r\n \"properties\": {\r\n \"vmId\": \"2166227c-710d-47dc-89d7-1e0c2204a60e\",\r\n + \ \"tags\": {},\r\n \"properties\": {\r\n \"vmId\": \"fa7d46b5-773d-473a-a566-1e752f7bc1b4\",\r\n \ \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\n },\r\n \ \"storageProfile\": {\r\n \"imageReference\": {\r\n \"publisher\": \"OpenLogic\",\r\n \"offer\": \"CentOS\",\r\n \"sku\": \"7.5\",\r\n \ \"version\": \"latest\",\r\n \"exactVersion\": \"7.5.201808150\"\r\n \ },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \"name\": - \"vm1_OsDisk_1_16f77247034d4ad58cb5947e940bbae7\",\r\n \"createOption\": + \"vm1_OsDisk_1_596b3873ac5f411baa2159082c23de45\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": - \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/disks/vm1_OsDisk_1_16f77247034d4ad58cb5947e940bbae7\"\r\n + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/disks/vm1_OsDisk_1_596b3873ac5f411baa2159082c23de45\"\r\n \ },\r\n \"diskSizeGB\": 30,\r\n \"deleteOption\": \"Detach\"\r\n \ },\r\n \"dataDisks\": []\r\n },\r\n \"osProfile\": {\r\n \ \"computerName\": \"vm1\",\r\n \"adminUsername\": \"azureuser\",\r\n @@ -464,21 +465,21 @@ interactions: \"ImageDefault\"\r\n }\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"}]},\r\n - \ \"provisioningState\": \"Succeeded\",\r\n \"instanceView\": {\r\n \"vmAgent\": - {\r\n \"vmAgentVersion\": \"Unknown\",\r\n \"statuses\": [\r\n - \ {\r\n \"code\": \"ProvisioningState/Unavailable\",\r\n - \ \"level\": \"Warning\",\r\n \"displayStatus\": \"Not - Ready\",\r\n \"message\": \"VM status blob is found but not yet - populated.\",\r\n \"time\": \"2021-05-25T06:22:05+00:00\"\r\n }\r\n - \ ]\r\n },\r\n \"disks\": [\r\n {\r\n \"name\": - \"vm1_OsDisk_1_16f77247034d4ad58cb5947e940bbae7\",\r\n \"statuses\": - [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n + \ \"provisioningState\": \"Succeeded\",\r\n \"instanceView\": {\r\n \"computerName\": + \"vm1\",\r\n \"osName\": \"centos\",\r\n \"osVersion\": \"7.5.1804\",\r\n + \ \"vmAgent\": {\r\n \"vmAgentVersion\": \"2.4.0.1\",\r\n \"statuses\": + [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n + \ \"level\": \"Info\",\r\n \"displayStatus\": \"Ready\",\r\n + \ \"message\": \"Guest Agent is running\",\r\n \"time\": + \"2021-07-29T10:03:14+00:00\"\r\n }\r\n ],\r\n \"extensionHandlers\": + []\r\n },\r\n \"disks\": [\r\n {\r\n \"name\": \"vm1_OsDisk_1_596b3873ac5f411baa2159082c23de45\",\r\n + \ \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-05-25T06:20:57.8715099+00:00\"\r\n + succeeded\",\r\n \"time\": \"2021-07-29T10:02:10.42447+00:00\"\r\n \ }\r\n ]\r\n }\r\n ],\r\n \"hyperVGeneration\": \"V1\",\r\n \"statuses\": [\r\n {\r\n \"code\": \"ProvisioningState/succeeded\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"Provisioning - succeeded\",\r\n \"time\": \"2021-05-25T06:22:02.4341884+00:00\"\r\n + succeeded\",\r\n \"time\": \"2021-07-29T10:03:11.8626284+00:00\"\r\n \ },\r\n {\r\n \"code\": \"PowerState/running\",\r\n \ \"level\": \"Info\",\r\n \"displayStatus\": \"VM running\"\r\n \ }\r\n ]\r\n }\r\n }\r\n}" @@ -486,11 +487,11 @@ interactions: cache-control: - no-cache content-length: - - '3240' + - '3328' content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:22:04 GMT + - Thu, 29 Jul 2021 10:03:21 GMT expires: - '-1' pragma: @@ -507,7 +508,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-resource: - - Microsoft.Compute/LowCostGet3Min;3963,Microsoft.Compute/LowCostGet30Min;31706 + - Microsoft.Compute/LowCostGet3Min;3993,Microsoft.Compute/LowCostGet30Min;31920 status: code: 200 message: OK @@ -525,18 +526,18 @@ interactions: ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-network/18.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2018-01-01 response: body: string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic\",\r\n - \ \"etag\": \"W/\\\"cc5c9e23-258d-4b4c-afe3-410201b68c4a\\\"\",\r\n \"location\": + \ \"etag\": \"W/\\\"864dbedd-0cd0-4409-b6cc-7741d4013cc5\\\"\",\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": - \"Succeeded\",\r\n \"resourceGuid\": \"68c4e0fe-d548-41df-b1a8-9c124570f79f\",\r\n + \"Succeeded\",\r\n \"resourceGuid\": \"5bdea094-0dee-4433-a2e1-7e7928919346\",\r\n \ \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\",\r\n - \ \"etag\": \"W/\\\"cc5c9e23-258d-4b4c-afe3-410201b68c4a\\\"\",\r\n + \ \"etag\": \"W/\\\"864dbedd-0cd0-4409-b6cc-7741d4013cc5\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkInterfaces/ipConfigurations\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\": @@ -545,8 +546,8 @@ interactions: \ },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\": \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"internalDomainNameSuffix\": - \"zc2dwfyb5obezbjfu5qrt1nckf.dx.internal.cloudapp.net\"\r\n },\r\n \"macAddress\": - \"00-0D-3A-38-04-67\",\r\n \"enableAcceleratedNetworking\": false,\r\n + \"d4fncu3wuz3u1e4elqpuj2t2ic.dx.internal.cloudapp.net\"\r\n },\r\n \"macAddress\": + \"00-0D-3A-31-58-0C\",\r\n \"enableAcceleratedNetworking\": false,\r\n \ \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\": {\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\r\n \ },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \"id\": @@ -560,9 +561,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:22:06 GMT + - Thu, 29 Jul 2021 10:03:24 GMT etag: - - W/"cc5c9e23-258d-4b4c-afe3-410201b68c4a" + - W/"864dbedd-0cd0-4409-b6cc-7741d4013cc5" expires: - '-1' pragma: @@ -579,7 +580,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 0c050338-4daa-48a7-9d05-ab39c8733d0c + - be04a74b-cc10-4484-be07-45d379dea1f2 status: code: 200 message: OK @@ -597,16 +598,16 @@ interactions: ParameterSetName: - -g -n --image --nsg-rule --admin-username --admin-password --authentication-type User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-network/18.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-network/19.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP?api-version=2018-01-01 response: body: string: "{\r\n \"name\": \"vm1PublicIP\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\",\r\n - \ \"etag\": \"W/\\\"aff8e100-d2a9-4b13-89ad-98110b7e6ad4\\\"\",\r\n \"location\": + \ \"etag\": \"W/\\\"c6b48549-65c1-4dcf-b017-1b6c437376dd\\\"\",\r\n \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": - \"Succeeded\",\r\n \"resourceGuid\": \"b2970d1a-3b83-4ae4-8217-36e9659f19e7\",\r\n - \ \"ipAddress\": \"13.88.113.211\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n + \"Succeeded\",\r\n \"resourceGuid\": \"e71e8767-9d67-4c50-bca8-5441947bd778\",\r\n + \ \"ipAddress\": \"137.135.8.234\",\r\n \"publicIPAddressVersion\": \"IPv4\",\r\n \ \"publicIPAllocationMethod\": \"Dynamic\",\r\n \"idleTimeoutInMinutes\": 4,\r\n \"ipTags\": [],\r\n \"ipConfiguration\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\r\n \ }\r\n },\r\n \"type\": \"Microsoft.Network/publicIPAddresses\",\r\n @@ -619,9 +620,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:22:06 GMT + - Thu, 29 Jul 2021 10:03:24 GMT etag: - - W/"aff8e100-d2a9-4b13-89ad-98110b7e6ad4" + - W/"c6b48549-65c1-4dcf-b017-1b6c437376dd" expires: - '-1' pragma: @@ -638,7 +639,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - e7b0b116-65d4-40c4-82b1-896560ff3fb3 + - 1a6f285b-7b95-4327-b5cd-6cd91f91e6f9 status: code: 200 message: OK @@ -656,12 +657,12 @@ interactions: ParameterSetName: - -g -n --time --email --webhook User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/16.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001","name":"cli_test_vm_auto_shutdown000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-05-25T06:20:24Z"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001","name":"cli_test_vm_auto_shutdown000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-07-29T10:00:20Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -670,7 +671,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:22:06 GMT + - Thu, 29 Jul 2021 10:03:25 GMT expires: - '-1' pragma: @@ -706,24 +707,24 @@ interactions: ParameterSetName: - -g -n --time --email --webhook User-Agent: - - python/3.8.0 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-devtestlabs/4.0.0 Azure-SDK-For-Python AZURECLI/2.24.0 + - python/3.8.1 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.3 + azure-mgmt-devtestlabs/4.0.0 Azure-SDK-For-Python AZURECLI/2.26.1 accept-language: - en-US method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.DevTestLab/schedules/shutdown-computevm-vm1?api-version=2018-09-15 response: body: - string: '{"properties":{"status":"Enabled","taskType":"ComputeVmShutdownTask","dailyRecurrence":{"time":"1730"},"timeZoneId":"UTC","notificationSettings":{"status":"Enabled","timeInMinutes":30,"webhookUrl":"https://example.com/","emailRecipient":"foo@bar.com"},"createdDate":"2021-05-25T06:22:11.6563246+00:00","targetResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1","provisioningState":"Succeeded","uniqueIdentifier":"5c7f655b-e086-41f8-a537-eb8d4c752d02"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/microsoft.devtestlab/schedules/shutdown-computevm-vm1","name":"shutdown-computevm-vm1","type":"microsoft.devtestlab/schedules","location":"westus"}' + string: '{"properties":{"status":"Enabled","taskType":"ComputeVmShutdownTask","dailyRecurrence":{"time":"1730"},"timeZoneId":"UTC","notificationSettings":{"status":"Enabled","timeInMinutes":30,"webhookUrl":"https://example.com/","emailRecipient":"foo@bar.com"},"createdDate":"2021-07-29T10:03:31.863878+00:00","targetResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1","provisioningState":"Succeeded","uniqueIdentifier":"cc912619-f038-41e1-a987-441899ae7f1f"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/microsoft.devtestlab/schedules/shutdown-computevm-vm1","name":"shutdown-computevm-vm1","type":"microsoft.devtestlab/schedules","location":"westus"}' headers: cache-control: - no-cache content-length: - - '911' + - '910' content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:22:13 GMT + - Thu, 29 Jul 2021 10:03:33 GMT expires: - '-1' pragma: @@ -731,18 +732,114 @@ interactions: request-context: - appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a server: - - Kestrel + - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1188' + - '1198' x-powered-by: - ASP.NET status: code: 201 message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm auto-shutdown + Connection: + - keep-alive + ParameterSetName: + - -g -n --time --email + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001?api-version=2021-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001","name":"cli_test_vm_auto_shutdown000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-07-29T10:00:20Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '428' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 29 Jul 2021 10:03:34 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": "westus", "properties": {"status": "Enabled", "taskType": + "ComputeVmShutdownTask", "dailyRecurrence": {"time": "1730"}, "timeZoneId": + "UTC", "notificationSettings": {"status": "Enabled", "timeInMinutes": 30, "emailRecipient": + "foo2@bar.com"}, "targetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - vm auto-shutdown + Connection: + - keep-alive + Content-Length: + - '470' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n --time --email + User-Agent: + - python/3.8.1 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.3 + azure-mgmt-devtestlabs/4.0.0 Azure-SDK-For-Python AZURECLI/2.26.1 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.DevTestLab/schedules/shutdown-computevm-vm1?api-version=2018-09-15 + response: + body: + string: '{"properties":{"status":"Enabled","taskType":"ComputeVmShutdownTask","dailyRecurrence":{"time":"1730"},"timeZoneId":"UTC","notificationSettings":{"status":"Enabled","timeInMinutes":30,"emailRecipient":"foo2@bar.com"},"createdDate":"2021-07-29T10:03:31.863878+00:00","targetResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001/providers/Microsoft.Compute/virtualMachines/vm1","provisioningState":"Succeeded","uniqueIdentifier":"cc912619-f038-41e1-a987-441899ae7f1f"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001/providers/microsoft.devtestlab/schedules/shutdown-computevm-vm1","name":"shutdown-computevm-vm1","type":"microsoft.devtestlab/schedules","location":"westus"}' + headers: + cache-control: + - no-cache + content-length: + - '875' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 29 Jul 2021 10:03:35 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + status: + code: 201 + message: Created - request: body: null headers: @@ -757,12 +854,12 @@ interactions: ParameterSetName: - -g -n --off User-Agent: - - AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/16.1.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.1 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_vm_auto_shutdown000001?api-version=2021-04-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001","name":"cli_test_vm_auto_shutdown000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-05-25T06:20:24Z"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vm_auto_shutdown000001","name":"cli_test_vm_auto_shutdown000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-07-29T10:00:20Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -771,7 +868,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 25 May 2021 06:22:14 GMT + - Thu, 29 Jul 2021 10:03:36 GMT expires: - '-1' pragma: @@ -801,8 +898,8 @@ interactions: ParameterSetName: - -g -n --off User-Agent: - - python/3.8.0 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.3 - azure-mgmt-devtestlabs/4.0.0 Azure-SDK-For-Python AZURECLI/2.24.0 + - python/3.8.1 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.3 + azure-mgmt-devtestlabs/4.0.0 Azure-SDK-For-Python AZURECLI/2.26.1 accept-language: - en-US method: DELETE @@ -816,7 +913,7 @@ interactions: content-length: - '0' date: - - Tue, 25 May 2021 06:22:18 GMT + - Thu, 29 Jul 2021 10:03:41 GMT expires: - '-1' pragma: @@ -828,7 +925,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14998' + - '14999' status: code: 200 message: OK 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 485e1ceb6ba..b0affc716dc 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 @@ -5169,6 +5169,7 @@ def test_vm_auto_shutdown(self, resource_group): 'vm': 'vm1' }) self.cmd('vm create -g {rg} -n {vm} --image centos --nsg-rule NONE --admin-username azureuser --admin-password testPassword0 --authentication-type password') + self.cmd('vm auto-shutdown -g {rg} -n {vm} --time 1730 --email "foo@bar.com" --webhook "https://example.com/"', checks=[ self.check('name', 'shutdown-computevm-{vm}'), self.check('taskType', 'ComputeVmShutdownTask'), @@ -5178,6 +5179,16 @@ def test_vm_auto_shutdown(self, resource_group): self.check('notificationSettings.webhookUrl', 'https://example.com/'), self.check('notificationSettings.emailRecipient', 'foo@bar.com') ]) + + self.cmd('vm auto-shutdown -g {rg} -n {vm} --time 1730 --email "foo2@bar.com" ', checks=[ + self.check('name', 'shutdown-computevm-{vm}'), + self.check('taskType', 'ComputeVmShutdownTask'), + self.check('status', 'Enabled'), + self.check('dailyRecurrence.time', '1730'), + self.check('notificationSettings.status', 'Enabled'), + self.check('notificationSettings.emailRecipient', 'foo2@bar.com') + ]) + self.cmd('vm auto-shutdown -g {rg} -n {vm} --off')