Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.PolicyInsights" Version="3.0.0" />
<PackageReference Include="Microsoft.Azure.Management.PolicyInsights" Version="3.1.0" />
</ItemGroup>

</Project>
24 changes: 12 additions & 12 deletions src/PolicyInsights/PolicyInsights.Test/ScenarioTests/Common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Gets test resource group group name
#>
function Get-TestResourceGroupName
{
"cleanupservice"
"cheggpolicy"
}

<#
Expand All @@ -36,7 +36,7 @@ Gets test resource id
#>
function Get-TestResourceId
{
"/subscriptions/0b40be06-04e8-4f70-abde-a502b2646fe8/resourcegroups/cleanupservice/providers/Microsoft.KeyVault/vaults/kv12-cleanupservice"
"/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourcegroups/cheggpolicy/providers/microsoft.keyvault/vaults/cheggkv"
}

<#
Expand All @@ -45,7 +45,7 @@ Gets test policy set definition name
#>
function Get-TestPolicySetDefinitionName
{
"716ef2c9-4404-4673-8609-f984d58c417d"
"81811175-958c-478d-936a-d96e158a8c66"
}

<#
Expand All @@ -54,7 +54,7 @@ Gets test policy definition name
#>
function Get-TestPolicyDefinitionName
{
"policy2"
"3520924f-7a65-4cbf-83e6-e2ed67bbf0da"
}

<#
Expand All @@ -63,7 +63,7 @@ Gets test policy assignment name
#>
function Get-TestPolicyAssignmentName
{
"SecurityCenterBuiltIn"
"1e4e70f9cd4846268b6998ee"
}

<#
Expand All @@ -72,7 +72,7 @@ Gets test resource group group name for resource group level policy assignment (
#>
function Get-TestResourceGroupNameForPolicyAssignmentEvents
{
"cleanupservice"
"cheggpolicy"
}

<#
Expand All @@ -81,7 +81,7 @@ Gets test policy assignment name (resource group level) (for event tests)
#>
function Get-TestPolicyAssignmentNameResourceGroupLevelEvents
{
"568e500984414fbe8a4f10d0"
"8a4555d353ed46bb856e9890"
}

<#
Expand All @@ -90,7 +90,7 @@ Gets test policy definition name for events
#>
function Get-TestPolicyDefinitionNameForEvents
{
"d994a92a-7669-4735-9950-bdcc326f32e4"
"926d9eb2-ac1e-4408-b27a-9c61a70f8ff8"
}

<#
Expand All @@ -99,7 +99,7 @@ Gets test resource group group name for resource group level policy assignment (
#>
function Get-TestResourceGroupNameForPolicyAssignmentStates
{
"cleanupservice"
"cheggpolicy"
}

<#
Expand All @@ -108,7 +108,7 @@ Gets test policy assignment name (resource group level) (for state tests)
#>
function Get-TestPolicyAssignmentNameResourceGroupLevelStates
{
"147b065f2a0f409ca31325c7"
"8a4555d353ed46bb856e9890"
}

<#
Expand All @@ -117,7 +117,7 @@ Gets test query interval start
#>
function Get-TestQueryIntervalStart
{
"2019-12-01 00:00:00Z"
"2020-03-24 00:00:00Z"
}

<#
Expand All @@ -126,7 +126,7 @@ Gets test query interval end
#>
function Get-TestQueryIntervalEnd
{
"2019-12-06 00:00:00Z"
"2020-03-30 00:00:00Z"
}

<#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,30 @@ public void AllResourceGroupLevelPolicyAssignmentScope()
}

#endregion

#region Trigger Evaluation

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TriggerEvaluationSubscriptionScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Start-AzPolicyComplianceScan-SubscriptionScope");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TriggerEvaluationResourceGroupScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Start-AzPolicyComplianceScan-ResourceGroupScope");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TriggerEvaluationSubscriptionScope_AsJob()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Start-AzPolicyComplianceScan-SubscriptionScope-AsJob");
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,34 @@ function Get-AzureRmPolicyState-AllResourceGroupLevelPolicyAssignmentScope
$policyStates = Get-AzPolicyState -All -ResourceGroupName $resourceGroupName -PolicyAssignmentName $policyAssignmentName -Top 10
Validate-PolicyStates $policyStates 10
}

<#
.SYNOPSIS
Trigger a policy compliance scan at subscription scope
#>
function Start-AzPolicyComplianceScan-SubscriptionScope
{
Assert-True { Start-AzPolicyComplianceScan -PassThru }
}

<#
.SYNOPSIS
Trigger a policy compliance scan at subscription scope
#>
function Start-AzPolicyComplianceScan-SubscriptionScope-AsJob
{
$job = Start-AzPolicyComplianceScan -PassThru -AsJob
$job | Wait-Job
Assert-AreEqual "Completed" $job.State
Assert-True { $job | Receive-Job }
}

<#
.SYNOPSIS
Trigger a policy compliance scan at resource group scope
#>
function Start-AzPolicyComplianceScan-ResourceGroupScope
{
$resourceGroupName = Get-TestResourceGroupNameForPolicyAssignmentStates
Assert-True { Start-AzPolicyComplianceScan -ResourceGroupName $resourceGroupName -PassThru }
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading