New-AzPolicyAttestation
Hiermee maakt u een nieuwe beleidsverklaring voor een beleidstoewijzing.
Syntax
New-AzPolicyAttestation
-Name <String>
[-Scope <String>]
[-ResourceGroupName <String>]
-PolicyAssignmentId <String>
[-ComplianceState <String>]
[-PolicyDefinitionReferenceId <String>]
[-ExpiresOn <DateTime>]
[-Owner <String>]
[-Comment <String>]
[-Evidence <PSAttestationEvidence[]>]
[-AssessmentDate <DateTime>]
[-Metadata <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzPolicyAttestation
-ResourceId <String>
-PolicyAssignmentId <String>
[-ComplianceState <String>]
[-PolicyDefinitionReferenceId <String>]
[-ExpiresOn <DateTime>]
[-Owner <String>]
[-Comment <String>]
[-Evidence <PSAttestationEvidence[]>]
[-AssessmentDate <DateTime>]
[-Metadata <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
De cmdlet New-AzPolicyAttestation maakt een beleidsverklaring voor een bepaalde beleidstoewijzing. Attestations worden door Azure Policy gebruikt om nalevingsstatussen van resources of bereiken in te stellen waarop handmatig beleid is gericht. Ze bieden gebruikers ook de mogelijkheid om aanvullende metagegevens te verstrekken of een koppeling te maken naar bewijs dat bij de geteste nalevingsstatus hoort.
Voorbeelden
Voorbeeld 1: Een attestation maken binnen het abonnementsbereik
Set-AzContext -Subscription "d1acb22b-c876-44f7-b08e-3fcf9f6767f4"
$policyAssignmentId = "/subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/providers/microsoft.authorization/policyassignments/psattestationsubassignment"
$attestationName = "attestation-subscription"
New-AzPolicyAttestation -PolicyAssignmentId $policyAssignmentId -Name $attestationName -ComplianceState "Compliant"
Id : /subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/providers/microsoft.policyinsights
/attestations/attestation-subscription
Name : attestation-subscription
Type : Microsoft.PolicyInsights/attestations
PolicyAssignmentId : /subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/providers/microsoft.authorization/
policyassignments/psattestationsubassignment
PolicyDefinitionReferenceId :
ComplianceState : Compliant
ExpiresOn :
Owner :
Comment :
Evidence :
ProvisioningState : Succeeded
LastComplianceStateChangeAt : 1/27/2023 2:26:24 AM
AssessmentDate :
Metadata :
SystemData :
Met deze opdracht maakt u een nieuwe beleidsverklaring bij abonnement 'd1acb22b-c876-44f7-b08e-3fcf9f6767f4' voor de opgegeven beleidstoewijzing.
Opmerking: met deze opdracht maakt u een attestation voor het abonnement en niet de onderliggende resources. Voor het gemak van beheer moet handmatig beleid worden ontworpen om het bereik te bepalen dat de grens definieert van resources waarvan de nalevingsstatus moet worden getest. In dit geval moet het handmatige beleid gericht zijn op
Microsoft.Resources/subscriptions
. Ga voor meer informatie naar meer informatie over https://learn.microsoft.com/en-us/azure/governance/policy/concepts/attestation-structure de aanbevolen procedures voor het maken van attestations.
Voorbeeld 2: Een attestation maken bij de resourcegroep
$policyAssignmentId = "/subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/providers/microsoft.authorization/policyassignments/psattestationrgassignment"
$attestationName = "attestation-RG"
$rgName = "ps-attestation-test-rg"
New-AzPolicyAttestation -ResourceGroupName $RGName -PolicyAssignmentId $policyAssignmentId -Name $attestationName -ComplianceState "Compliant"
Id : /subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/resourcegroups/ps-attestation-test
-rg/providers/microsoft.policyinsights/attestations/attestation-rg
Name : attestation-RG
Type : Microsoft.PolicyInsights/attestations
PolicyAssignmentId : /subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/providers/microsoft.authorization/
policyassignments/psattestationrgassignment
PolicyDefinitionReferenceId :
ComplianceState : Compliant
ExpiresOn :
Owner :
Comment :
Evidence :
ProvisioningState : Succeeded
LastComplianceStateChangeAt : 1/27/2023 2:35:28 AM
AssessmentDate :
Metadata :
SystemData :
Met deze opdracht maakt u een nieuwe beleidsverklaring bij de resourcegroep 'ps-attestation-test-rg' voor de opgegeven beleidstoewijzing.
Opmerking: met deze opdracht maakt u een attestation voor de resourcegroep en niet de onderliggende resources. Voor het gemak van beheer moet handmatig beleid worden ontworpen om het bereik te bepalen dat de grens definieert van resources waarvan de nalevingsstatus moet worden getest. In dit geval moet het handmatige beleid gericht zijn op
Microsoft.Resources/subscriptions/resourceGroups
. Ga voor meer informatie naar meer informatie over https://learn.microsoft.com/en-us/azure/governance/policy/concepts/attestation-structure de aanbevolen procedures voor het maken van attestations.
Voorbeeld 3: Een attestation maken bij de resource
$policyAssignmentId = "/subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/providers/microsoft.authorization/policyassignments/psattestationresourceassignment"
$attestationName = "attestation-resource"
$scope = "/subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/resourceGroups/ps-attestation-test-rg/providers/Microsoft.Network/networkSecurityGroups/pstests0"
New-AzPolicyAttestation `
-PolicyAssignmentId $policyAssignmentId `
-Name $attestationName `
-Scope $scope `
-ComplianceState "NonCompliant"
Id : /subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/resourcegroups/ps-attestation-test
-rg/providers/microsoft.network/networksecuritygroups/pstests0/providers/microsoft.pol
icyinsights/attestations/attestation-resource
Name : attestation-resource
Type : Microsoft.PolicyInsights/attestations
PolicyAssignmentId : /subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/providers/microsoft.authorization/
policyassignments/psattestationresourceassignment
PolicyDefinitionReferenceId :
ComplianceState : NonCompliant
ExpiresOn :
Owner :
Comment :
Evidence :
ProvisioningState : Succeeded
LastComplianceStateChangeAt : 1/27/2023 2:38:17 AM
AssessmentDate :
Metadata :
SystemData :
Met deze opdracht maakt u een attestation voor de resource 'pstests0' voor de opgegeven beleidstoewijzing.
Voorbeeld 4: Een attestation maken met alle eigenschappen in de resourcegroep
$attestationName = "attestationRGAllProps"
$policyInitiativeAssignmentId = "/subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/providers/microsoft.authorization/policyassignments/psattestationinitiativergassignment"
$policyDefinitionReferenceId = "PSTestAttestationRG_1"
$RGName = "ps-attestation-test-rg"
$description = "This is a test description"
$sourceURI = "https://contoso.org/test.pdf"
$evidence = @{
"Description"=$description
"SourceUri"=$sourceURI
}
$policyEvidence = @($evidence)
$owner = "Test Owner"
$expiresOn = [datetime]::UtcNow.AddYears(1)
$metadata = '{"TestKey":"TestValue"}'
New-AzPolicyAttestation `
-Name $attestationName `
-ResourceGroupName $RGName `
-PolicyAssignmentId $policyInitiativeAssignmentId `
-PolicyDefinitionReferenceId $policyDefinitionReferenceId `
-ComplianceState $Compliant `
-Comment $comment `
-Evidence $policyEvidence `
-ExpiresOn $expiresOn `
-AssessmentDate $expiresOn.AddDays(-2) `
-Owner $owner `
-Metadata $metadata
Id : /subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/resourcegroups/ps-attestation-test
-rg/providers/microsoft.policyinsights/attestations/attestationrgallprops
Name : attestationRGAllProps
Type : Microsoft.PolicyInsights/attestations
PolicyAssignmentId : /subscriptions/d1acb22b-c876-44f7-b08e-3fcf9f6767f4/providers/microsoft.authorization/
policyassignments/psattestationinitiativergassignment
PolicyDefinitionReferenceId : pstestattestationrg_1
ComplianceState :
ExpiresOn : 1/27/2024 2:51:54 AM
Owner : Test Owner
Comment :
Evidence : {Microsoft.Azure.Commands.PolicyInsights.Models.Attestations.PSAttestationEvidence}
ProvisioningState : Succeeded
LastComplianceStateChangeAt : 1/27/2023 2:51:57 AM
AssessmentDate : 1/25/2024 2:51:54 AM
Metadata : {
"TestKey": "TestValue"
}
SystemData :
Parameters
-AssessmentDate
Het tijdstip waarop het bewijs van een attestation is beoordeeld.
Type: | Nullable<T>[DateTime] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Comment
Opmerkingen waarin wordt beschreven waarom deze attestation is gemaakt.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ComplianceState
De nalevingsstatus van de resource. Bijvoorbeeld 'Compatibel', 'Niet-compatibel', 'Onbekend'
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Confirm
Hiermee wordt u gevraagd om bevestiging voordat u de cmdlet uitvoert.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
De referenties, accounts, tenants en abonnementen die worden gebruikt voor communicatie met Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Evidence
Het bewijs dat de nalevingsstatus in deze attestation ondersteunt.
Type: | PSAttestationEvidence[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ExpiresOn
Het tijdstip waarop de nalevingsstatus die in de attestation is ingesteld, moet verlopen.
Type: | Nullable<T>[DateTime] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Metadata
Aanvullende metagegevens voor de attestation.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
Resourcenaam.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Owner
De persoon die verantwoordelijk is voor het instellen van de status van de resource. Deze waarde is doorgaans een Microsoft Entra-object-id.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PolicyAssignmentId
Id van beleidstoewijzing. Bijvoorbeeld '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{assignmentName}'.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PolicyDefinitionReferenceId
De referentie-id van de beleidsdefinitie van de afzonderlijke definitie. Vereist wanneer de beleidstoewijzing een beleidssetdefinitie toewijst.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
Naam van de resourcegroep.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceId
Resource-id.
Type: | String |
Aliases: | Id |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Scope
Bereik van de resource. Bijvoorbeeld /subscriptions/{subscriptionId}/resourceGroups/{rgName}.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WhatIf
Hiermee wordt weergegeven wat er zou gebeuren als u de cmdlet uitvoert. De cmdlet wordt niet uitgevoerd.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Invoerwaarden
Nullable<T>[[System.DateTime, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]