diff --git a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs index 7aacca793325..440c996a629d 100644 --- a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs +++ b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.cs @@ -59,5 +59,40 @@ public void TestAzureRmDtlAutoStartPolicy() { TestRunner.RunTestScript("Test-AzureRmDtlAutoStartPolicy"); } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlAutoStartPolicy() + { + TestRunner.RunTestScript("Test-AzDtlAutoStartPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlAutoShutdownPolicy() + { + TestRunner.RunTestScript("Test-AzDtlAutoShutdownPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlAllowedVMSizesPolicy() + { + TestRunner.RunTestScript("Test-AzDtlAllowedVMSizesPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlVMsPerUserPolicy() + { + TestRunner.RunTestScript("Test-AzDtlVMsPerUserPolicy"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestAzDtlVMsPerLabPolicy() + { + TestRunner.RunTestScript("Test-AzDtlVMsPerLabPolicy"); + } } } diff --git a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 index 7e74ca86a404..ac3080bbfcb0 100644 --- a/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 +++ b/src/DevTestLabs/DevTestLabs.Test/ScenarioTests/PolicyTests.ps1 @@ -16,7 +16,7 @@ .SYNOPSIS Tests AzureRmDtlVMsPerLabPolicy #> -function Test-AzDtlVMsPerLabPolicy +function Test-AzureRmDtlVMsPerLabPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -44,7 +44,7 @@ function Test-AzDtlVMsPerLabPolicy .SYNOPSIS Tests AzureRmDtlVMsPerUserPolicy #> -function Test-AzDtlVMsPerUserPolicy +function Test-Test-AzureRmDtlVMsPerUserPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -70,7 +70,7 @@ function Test-AzDtlVMsPerUserPolicy .SYNOPSIS Tests AzureRmDtlAllowedVMSizesPolicy #> -function Test-AzDtlAllowedVMSizesPolicy +function Test-AzureRmDtlAllowedVMSizesPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -96,14 +96,14 @@ function Test-AzDtlAllowedVMSizesPolicy .SYNOPSIS Tests AzureRmDtlAllowedVMSizesPolicy #> -function Test-AzDtlAutoShutdownPolicy +function Test-AzureRmDtlAutoShutdownPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" try { - $policy = Set-AzDtlAutoShutdownPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName + $policy = Set-AzDtlAutoShutdownPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Enable $readBack = Get-AzDtlAutoShutdownPolicy -LabName $labName -ResourceGroupName $rgName Assert-AreEqual "Enabled" $policy.Status @@ -122,7 +122,7 @@ function Test-AzDtlAutoShutdownPolicy .SYNOPSIS Tests AzureRmDtlAutoStartPolicy #> -function Test-AzDtlAutoStartPolicy +function Test-AzureRmDtlAutoStartPolicy { $rgName = Get-ResourceGroupName $labName = Get-ResourceName "onesdk" @@ -154,3 +154,115 @@ function Test-AzDtlAutoStartPolicy Clean-ResourceGroup $rgName } } + +<# +.SYNOPSIS +Tests AzDtlAutoStartPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlAutoStartPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlAutoStartPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Enable + $readBack = Get-AzDtlAutoStartPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "1330" $policy.WeeklyRecurrence.Time + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "1330" $readBack.WeeklyRecurrence.Time + + $policy = Set-AzDtlAutoStartPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Days Monday, Tuesday + $readBack = Get-AzDtlAutoStartPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "1330" $policy.WeeklyRecurrence.Time + Assert-AreEqualArray ([System.DayOfWeek]::Monday, [System.DayOfWeek]::Tuesday) $policy.WeeklyRecurrence.Weekdays + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "1330" $readBack.WeeklyRecurrence.Time + Assert-AreEqualArray ([System.DayOfWeek]::Monday, [System.DayOfWeek]::Tuesday) $readBack.WeeklyRecurrence.Weekdays +} + +<# +.SYNOPSIS +Tests AzDtlAutoShutdownPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlAutoShutdownPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlAutoShutdownPolicy -Time "13:30:00" -LabName $labName -ResourceGroupName $rgName -Enable + $readBack = Get-AzDtlAutoShutdownPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "1330" $policy.DailyRecurrence.Time + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "1330" $readBack.DailyRecurrence.Time +} + +<# +.SYNOPSIS +Tests AzDtlAllowedVMSizesPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlAllowedVMSizesPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlAllowedVMSizesPolicy -Enable -LabName $labName -ResourceGroupName $rgName -VmSizes Standard_A3, Standard_A0 + $readBack = Get-AzDtlAllowedVMSizesPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual '["Standard_A3","Standard_A0"]' $policy.Threshold + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual '["Standard_A3","Standard_A0"]' $readBack.Threshold +} + +<# +.SYNOPSIS +Tests AzDtlVMsPerUserPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlVMsPerUserPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + $policy = Set-AzDtlVMsPerUserPolicy -MaxVMs 5 -LabName $labName -ResourceGroupName $rgName + $readBack = Get-AzDtlVMsPerUserPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "5" $policy.Threshold + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "5" $readBack.Threshold +} + +<# +.SYNOPSIS +Tests AzDtlVMsPerLabPolicy +Setup: Create lab "onesdklab0111" in group 'DTL-TestGroup' +#> +function Test-AzDtlVMsPerLabPolicy +{ + $rgName = 'DTL-TestGroup' + $labName = "onesdklab0111" + + # Max VMs per lab policy + $policy = Set-AzDtlVMsPerLabPolicy -MaxVMs 5 -LabName $labName -ResourceGroupName $rgName + $readBack = Get-AzDtlVMsPerLabPolicy -LabName $labName -ResourceGroupName $rgName + + Assert-AreEqual "Enabled" $policy.Status + Assert-AreEqual "5" $policy.Threshold + + Assert-AreEqual "Enabled" $readBack.Status + Assert-AreEqual "5" $readBack.Threshold +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json new file mode 100644 index 000000000000..8777901365e8 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAllowedVMSizesPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/AllowedVmSizesInLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvQWxsb3dlZFZtU2l6ZXNJbkxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "050f81ad-013b-4133-8f8a-1c02a6022869" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "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-global-reads": [ + "3749" + ], + "x-ms-request-id": [ + "f5cda775-525e-4d10-8ea7-e126e306a22b" + ], + "x-ms-correlation-request-id": [ + "f5cda775-525e-4d10-8ea7-e126e306a22b" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033518Z:f5cda775-525e-4d10-8ea7-e126e306a22b" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 4CB94D8DA8A542468EBF164429D685CC Ref B: MAA201060513037 Ref C: 2024-11-01T03:35:17Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:35:17 GMT" + ], + "Content-Length": [ + "169" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceInGroupDoesNotExist\",\r\n \"message\": \"The resource 'onesdklab0111/default/AllowedVmSizesInLab' under resource group 'DTL-TestGroup' was not found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/AllowedVmSizesInLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvQWxsb3dlZFZtU2l6ZXNJbkxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "220b2aa6-641a-407f-a2df-227076c301c6" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "c62ecc91-6316-4af5-8d57-22bc9f00de66" + ], + "x-ms-correlation-request-id": [ + "c62ecc91-6316-4af5-8d57-22bc9f00de66" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033522Z:c62ecc91-6316-4af5-8d57-22bc9f00de66" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: F9007A24BD274FDAAAC80A51DFF548D6 Ref B: MAA201060516031 Ref C: 2024-11-01T03:35:21Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:35:21 GMT" + ], + "Content-Length": [ + "522" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmSize\",\r\n \"threshold\": \"[\\\"Standard_A3\\\",\\\"Standard_A0\\\"]\",\r\n \"evaluatorType\": \"AllowedValuesPolicy\",\r\n \"createdDate\": \"2024-11-01T11:35:19.9707846+08:00\",\r\n \"uniqueIdentifier\": \"7f7b005b-6055-4a88-9aa8-5032caa6b191\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/allowedvmsizesinlab\",\r\n \"name\": \"AllowedVmSizesInLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/AllowedVmSizesInLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvQWxsb3dlZFZtU2l6ZXNJbkxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "050f81ad-013b-4133-8f8a-1c02a6022869" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "183" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmSize\",\r\n \"threshold\": \"[\\\"Standard_A3\\\",\\\"Standard_A0\\\"]\",\r\n \"evaluatorType\": \"AllowedValuesPolicy\"\r\n }\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "884844a1-1274-49e2-85a0-ab39ea3954f9" + ], + "x-ms-correlation-request-id": [ + "884844a1-1274-49e2-85a0-ab39ea3954f9" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033520Z:884844a1-1274-49e2-85a0-ab39ea3954f9" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 983B9EF7BC444BD9BE572DAAD7432987 Ref B: MAA201060513037 Ref C: 2024-11-01T03:35:18Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:35:19 GMT" + ], + "Content-Length": [ + "522" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmSize\",\r\n \"threshold\": \"[\\\"Standard_A3\\\",\\\"Standard_A0\\\"]\",\r\n \"evaluatorType\": \"AllowedValuesPolicy\",\r\n \"createdDate\": \"2024-11-01T11:35:19.9707846+08:00\",\r\n \"uniqueIdentifier\": \"7f7b005b-6055-4a88-9aa8-5032caa6b191\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/allowedvmsizesinlab\",\r\n \"name\": \"AllowedVmSizesInLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json new file mode 100644 index 000000000000..6e108269a9c6 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoShutdownPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmsShutdown?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1zU2h1dGRvd24/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6c735816-aa31-4d3a-b531-062324cffdf8" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "34f23254-e8db-48d1-83ec-ce3ac2a9cebe" + ], + "x-ms-correlation-request-id": [ + "34f23254-e8db-48d1-83ec-ce3ac2a9cebe" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T031844Z:34f23254-e8db-48d1-83ec-ce3ac2a9cebe" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: A2D396486B89426E85F831FD2BC50FAB Ref B: MAA201060513017 Ref C: 2024-11-11T03:18:43Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:18:44 GMT" + ], + "Content-Length": [ + "593" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Disabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"createdDate\": \"2024-11-01T10:40:40.5258457+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmsshutdown\",\r\n \"name\": \"LabVmsShutdown\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmsShutdown?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1zU2h1dGRvd24/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "06a4084f-8a1f-494b-8ef0-8f3d300849bf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "e5d0007f-7606-46cd-bf21-cf7d3197f6c2" + ], + "x-ms-correlation-request-id": [ + "e5d0007f-7606-46cd-bf21-cf7d3197f6c2" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T031848Z:e5d0007f-7606-46cd-bf21-cf7d3197f6c2" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 61A544C7DA304440B69471987D88068F Ref B: MAA201060513049 Ref C: 2024-11-11T03:18:47Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:18:48 GMT" + ], + "Content-Length": [ + "592" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"createdDate\": \"2024-11-01T10:40:40.5258457+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmsshutdown\",\r\n \"name\": \"LabVmsShutdown\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmsShutdown?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1zU2h1dGRvd24/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6c735816-aa31-4d3a-b531-062324cffdf8" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "414" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\"\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "c8ad3b9d-33d6-4de6-874c-4c5794097dee" + ], + "x-ms-correlation-request-id": [ + "c8ad3b9d-33d6-4de6-874c-4c5794097dee" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T031847Z:c8ad3b9d-33d6-4de6-874c-4c5794097dee" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 2132F81AE4484EB59509D83550DAB1BD Ref B: MAA201060513017 Ref C: 2024-11-11T03:18:44Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:18:47 GMT" + ], + "Content-Length": [ + "592" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsShutdownTask\",\r\n \"dailyRecurrence\": {\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 30\r\n },\r\n \"createdDate\": \"2024-11-01T10:40:40.5258457+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"ded7b75f-8f5d-4612-95a6-58fb694a5065\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmsshutdown\",\r\n \"name\": \"LabVmsShutdown\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json new file mode 100644 index 000000000000..5709d1cc3ec0 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlAutoStartPolicy.json @@ -0,0 +1,452 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4ddc8e54-3fa3-4b55-a917-b245475d937a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "aaff6bed-4f4e-4069-bfc1-0516198c74e6" + ], + "x-ms-correlation-request-id": [ + "aaff6bed-4f4e-4069-bfc1-0516198c74e6" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032158Z:aaff6bed-4f4e-4069-bfc1-0516198c74e6" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 5051C1D4069B4897BAEA710BCFDEF0F8 Ref B: MAA201060514031 Ref C: 2024-11-11T03:21:57Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:21:57 GMT" + ], + "Content-Length": [ + "624" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Disabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1e1ea69a-d0c7-439e-bad9-33ec944bb819" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f0e237b7-882c-427d-b0c9-fb00e2dcaa66" + ], + "x-ms-correlation-request-id": [ + "f0e237b7-882c-427d-b0c9-fb00e2dcaa66" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032201Z:f0e237b7-882c-427d-b0c9-fb00e2dcaa66" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 00EF6D0B4CDD43DE9A4502C484B1709E Ref B: MAA201060513047 Ref C: 2024-11-11T03:22:00Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:01 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f25a9c07-dfe5-4e80-9cfb-62f63beed59a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3748" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "248" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "1e49bafa-aa11-4ab8-94be-82183d7d8f30" + ], + "x-ms-correlation-request-id": [ + "1e49bafa-aa11-4ab8-94be-82183d7d8f30" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032202Z:1e49bafa-aa11-4ab8-94be-82183d7d8f30" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 042F6E04C5A74250A15CCCA94AFD0E30 Ref B: MAA201060515019 Ref C: 2024-11-11T03:22:02Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:01 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "2af5f321-ca44-4c33-8996-4b5699ec97a2" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "d77d84a3-1d17-4114-a5e9-fc7f25ac80cd" + ], + "x-ms-correlation-request-id": [ + "d77d84a3-1d17-4114-a5e9-fc7f25ac80cd" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032206Z:d77d84a3-1d17-4114-a5e9-fc7f25ac80cd" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 5E7C0A0CDA034800A014B921D1798FB7 Ref B: MAA201060516033 Ref C: 2024-11-11T03:22:05Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:06 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4ddc8e54-3fa3-4b55-a917-b245475d937a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "482" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\"\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "37e0a746-39c3-452c-872c-09cf43464df8" + ], + "x-ms-correlation-request-id": [ + "37e0a746-39c3-452c-872c-09cf43464df8" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032200Z:37e0a746-39c3-452c-872c-09cf43464df8" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: B5C2BE0859DB440E88440CE6FFB01069 Ref B: MAA201060514031 Ref C: 2024-11-11T03:21:58Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:21:59 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/schedules/LabVmAutoStart?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9zY2hlZHVsZXMvTGFiVm1BdXRvU3RhcnQ/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f25a9c07-dfe5-4e80-9cfb-62f63beed59a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "482" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\"\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "5e86429d-b473-48db-ad18-928543b5bfb4" + ], + "x-ms-correlation-request-id": [ + "5e86429d-b473-48db-ad18-928543b5bfb4" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20241111T032205Z:5e86429d-b473-48db-ad18-928543b5bfb4" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 62B531DA896E4F4695A16178A0051769 Ref B: MAA201060515019 Ref C: 2024-11-11T03:22:02Z" + ], + "Date": [ + "Mon, 11 Nov 2024 03:22:04 GMT" + ], + "Content-Length": [ + "623" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"taskType\": \"LabVmsStartupTask\",\r\n \"weeklyRecurrence\": {\r\n \"weekdays\": [\r\n \"Monday\",\r\n \"Tuesday\"\r\n ],\r\n \"time\": \"1330\"\r\n },\r\n \"timeZoneId\": \"China Standard Time\",\r\n \"notificationSettings\": {\r\n \"status\": \"Disabled\",\r\n \"timeInMinutes\": 0\r\n },\r\n \"createdDate\": \"2024-11-01T11:11:43.3312844+08:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"uniqueIdentifier\": \"7d720399-1dd3-4428-97e9-b66e8d9a2282\"\r\n },\r\n \"location\": \"eastus\",\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/schedules/labvmautostart\",\r\n \"name\": \"LabVmAutoStart\",\r\n \"type\": \"microsoft.devtestlab/labs/schedules\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json new file mode 100644 index 000000000000..07b688774498 --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerLabPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlckxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "3b664c13-5968-41e5-9d72-6cac0e054ebf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "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-global-reads": [ + "3749" + ], + "x-ms-request-id": [ + "9e3fb57a-970d-4699-bb5e-7f061ef6e648" + ], + "x-ms-correlation-request-id": [ + "9e3fb57a-970d-4699-bb5e-7f061ef6e648" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033701Z:9e3fb57a-970d-4699-bb5e-7f061ef6e648" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: D521C054449A47E591E21E261602C4F9 Ref B: MAA201060514027 Ref C: 2024-11-01T03:37:00Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:37:00 GMT" + ], + "Content-Length": [ + "169" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceInGroupDoesNotExist\",\r\n \"message\": \"The resource 'onesdklab0111/default/MaxVmsAllowedPerLab' under resource group 'DTL-TestGroup' was not found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlckxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "be9832f8-810b-4d9d-81a0-f1046e8b7e20" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "2bb63946-45bc-4a4e-87fa-074ece018435" + ], + "x-ms-correlation-request-id": [ + "2bb63946-45bc-4a4e-87fa-074ece018435" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033704Z:2bb63946-45bc-4a4e-87fa-074ece018435" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: F037C67B80FA42B4BC8E49761D33B9E1 Ref B: MAA201060516023 Ref C: 2024-11-01T03:37:03Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:37:04 GMT" + ], + "Content-Length": [ + "486" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:37:02.7060624+08:00\",\r\n \"uniqueIdentifier\": \"cf89b591-e16d-445c-8589-7e2e66484ada\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperlab\",\r\n \"name\": \"MaxVmsAllowedPerLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerLab?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlckxhYj9hcGktdmVyc2lvbj0yMDE2LTA1LTE1", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "3b664c13-5968-41e5-9d72-6cac0e054ebf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "147" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\"\r\n }\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "e9a1f223-4bb8-47aa-b452-09ca31a5a033" + ], + "x-ms-correlation-request-id": [ + "e9a1f223-4bb8-47aa-b452-09ca31a5a033" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033703Z:e9a1f223-4bb8-47aa-b452-09ca31a5a033" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: CD8B5BFEC81F4AF2B43002B2C15CBEEA Ref B: MAA201060514027 Ref C: 2024-11-01T03:37:01Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:37:02 GMT" + ], + "Content-Length": [ + "486" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"LabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:37:02.7060624+08:00\",\r\n \"uniqueIdentifier\": \"cf89b591-e16d-445c-8589-7e2e66484ada\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperlab\",\r\n \"name\": \"MaxVmsAllowedPerLab\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file diff --git a/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json new file mode 100644 index 000000000000..2aaa0da70b0f --- /dev/null +++ b/src/DevTestLabs/DevTestLabs.Test/SessionRecords/Microsoft.Azure.Commands.DevTestLabs.Test.ScenarioTests.PolicyTests/TestAzDtlVMsPerUserPolicy.json @@ -0,0 +1,230 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerUser?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlclVzZXI/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1471528a-aa3c-4579-b31f-e2d705dfc543" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "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-global-reads": [ + "3749" + ], + "x-ms-request-id": [ + "de642470-c5c3-498e-940f-f472ddd7248e" + ], + "x-ms-correlation-request-id": [ + "de642470-c5c3-498e-940f-f472ddd7248e" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033650Z:de642470-c5c3-498e-940f-f472ddd7248e" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 3FCC5D72433B416DA6E8EAC05044B6B6 Ref B: MAA201060515035 Ref C: 2024-11-01T03:36:49Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:36:49 GMT" + ], + "Content-Length": [ + "170" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceInGroupDoesNotExist\",\r\n \"message\": \"The resource 'onesdklab0111/default/MaxVmsAllowedPerUser' under resource group 'DTL-TestGroup' was not found.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerUser?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlclVzZXI/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "GET", + "RequestHeaders": { + "x-ms-client-request-id": [ + "821f4a5b-43a4-4971-8259-a4d2e4e906e1" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ] + }, + "RequestBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-reads": [ + "3749" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "249" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f35675b0-a7eb-4790-83f8-2c53e7fa6591" + ], + "x-ms-correlation-request-id": [ + "f35675b0-a7eb-4790-83f8-2c53e7fa6591" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033653Z:f35675b0-a7eb-4790-83f8-2c53e7fa6591" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: 34F06ACA3ED444D5BEC8C4D117AD9623 Ref B: MAA201060515017 Ref C: 2024-11-01T03:36:53Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:36:53 GMT" + ], + "Content-Length": [ + "497" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"UserOwnedLabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:36:52.1386267+08:00\",\r\n \"uniqueIdentifier\": \"ad8295e8-e847-45ef-83a2-168ab8c83789\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperuser\",\r\n \"name\": \"MaxVmsAllowedPerUser\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/DTL-TestGroup/providers/Microsoft.DevTestLab/labs/onesdklab0111/policysets/default/policies/MaxVmsAllowedPerUser?api-version=2016-05-15", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGIxZjY0NzEtMWJmMC00ZGRhLWFlYzMtY2I5MjcyZjA5NTkwL3Jlc291cmNlR3JvdXBzL0RUTC1UZXN0R3JvdXAvcHJvdmlkZXJzL01pY3Jvc29mdC5EZXZUZXN0TGFiL2xhYnMvb25lc2RrbGFiMDExMS9wb2xpY3lzZXRzL2RlZmF1bHQvcG9saWNpZXMvTWF4Vm1zQWxsb3dlZFBlclVzZXI/YXBpLXZlcnNpb249MjAxNi0wNS0xNQ==", + "RequestMethod": "PUT", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1471528a-aa3c-4579-b31f-e2d705dfc543" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/6.0.3524.45918", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.26100", + "Microsoft.Azure.Management.DevTestLabs.DevTestLabsClient/2.0.2.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "156" + ] + }, + "RequestBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"UserOwnedLabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\"\r\n }\r\n}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-global-writes": [ + "2999" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "199" + ], + "Request-Context": [ + "appId=cid-v1:9e8cebda-9c88-460b-b55d-9410c4648f9a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "307bdfda-0e96-41d6-8cc9-f78eda3d8633" + ], + "x-ms-correlation-request-id": [ + "307bdfda-0e96-41d6-8cc9-f78eda3d8633" + ], + "x-ms-routing-request-id": [ + "SOUTHEASTASIA:20241101T033652Z:307bdfda-0e96-41d6-8cc9-f78eda3d8633" + ], + "X-Cache": [ + "CONFIG_NOCACHE" + ], + "X-MSEdge-Ref": [ + "Ref A: C822483FA4E44867B3F993B67FD38CD9 Ref B: MAA201060515035 Ref C: 2024-11-01T03:36:50Z" + ], + "Date": [ + "Fri, 01 Nov 2024 03:36:52 GMT" + ], + "Content-Length": [ + "497" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"status\": \"Enabled\",\r\n \"factName\": \"UserOwnedLabVmCount\",\r\n \"threshold\": \"5\",\r\n \"evaluatorType\": \"MaxValuePolicy\",\r\n \"createdDate\": \"2024-11-01T11:36:52.1386267+08:00\",\r\n \"uniqueIdentifier\": \"ad8295e8-e847-45ef-83a2-168ab8c83789\"\r\n },\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/dtl-testgroup/providers/microsoft.devtestlab/labs/onesdklab0111/policysets/default/policies/maxvmsallowedperuser\",\r\n \"name\": \"MaxVmsAllowedPerUser\",\r\n \"type\": \"Microsoft.DevTestLab/labs/policySets/policies\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590" + } +} \ No newline at end of file