Hiermee worden alle herstelbewerkingen voor het abonnement opgehaald.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations?api-version=2021-10-01
With optional parameters:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations?$top={$top}&$filter={$filter}&api-version=2021-10-01
URI-parameters
Name |
In |
Vereist |
Type |
Description |
subscriptionId
|
path |
True
|
string
|
Microsoft Azure-abonnements-id.
|
api-version
|
query |
True
|
string
|
Client-API-versie.
|
$filter
|
query |
|
string
|
OData-filterexpressie.
|
$top
|
query |
|
integer
int32
|
Maximum aantal records dat moet worden geretourneerd.
|
Antwoorden
Name |
Type |
Description |
200 OK
|
RemediationListResult
|
De opgehaalde herstelbewerkingen.
|
Other Status Codes
|
ErrorResponse
|
Foutreactie waarin wordt beschreven waarom de bewerking is mislukt.
|
Beveiliging
azure_auth
Azure Active Directory OAuth2-stroom
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
Uw gebruikersaccount imiteren
|
Voorbeelden
Sample Request
GET https://management.azure.com/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/Microsoft.PolicyInsights/remediations?api-version=2021-10-01
import com.azure.core.util.Context;
/** Samples for Remediations List. */
public final class Main {
/*
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope.json
*/
/**
* Sample code: List remediations at subscription scope.
*
* @param manager Entry point to PolicyInsightsManager.
*/
public static void listRemediationsAtSubscriptionScope(
com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) {
manager.remediations().list(null, null, Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.policyinsights import PolicyInsightsClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-policyinsights
# USAGE
python remediations_list_subscription_scope.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PolicyInsightsClient(
credential=DefaultAzureCredential(),
subscription_id="35ee058e-5fa0-414c-8145-3ebb8d09b6e2",
)
response = client.remediations.list_for_subscription()
for item in response:
print(item)
# x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpolicyinsights_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/05a9cdab363b8ec824094ee73950c04594325172/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope.json
func ExampleRemediationsClient_NewListForSubscriptionPager_listRemediationsAtSubscriptionScope() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpolicyinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewRemediationsClient().NewListForSubscriptionPager(&armpolicyinsights.QueryOptions{Top: nil,
Filter: nil,
OrderBy: nil,
Select: nil,
From: nil,
To: nil,
Apply: nil,
SkipToken: nil,
Expand: nil,
}, nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.RemediationListResult = armpolicyinsights.RemediationListResult{
// Value: []*armpolicyinsights.Remediation{
// {
// Name: to.Ptr("790996e6-9871-4b1f-9cd9-ec42cd6ced1e"),
// Type: to.Ptr("Microsoft.PolicyInsights/remediations"),
// ID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.policyinsights/remediations/790996e6-9871-4b1f-9cd9-ec42cd6ced1e"),
// Properties: &armpolicyinsights.RemediationProperties{
// CorrelationID: to.Ptr("a14e1d60-dae9-4771-b4be-a556d69e77a6"),
// CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:51:09.075Z"); return t}()),
// DeploymentStatus: &armpolicyinsights.RemediationDeploymentSummary{
// FailedDeployments: to.Ptr[int32](0),
// SuccessfulDeployments: to.Ptr[int32](2),
// TotalDeployments: to.Ptr[int32](2),
// },
// FailureThreshold: &armpolicyinsights.RemediationPropertiesFailureThreshold{
// Percentage: to.Ptr[float32](0.1),
// },
// LastUpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:52:10.001Z"); return t}()),
// ParallelDeployments: to.Ptr[int32](6),
// PolicyAssignmentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
// ProvisioningState: to.Ptr("Succeeded"),
// ResourceCount: to.Ptr[int32](42),
// ResourceDiscoveryMode: to.Ptr(armpolicyinsights.ResourceDiscoveryModeExistingNonCompliant),
// StatusMessage: to.Ptr("Remediation extended status"),
// },
// SystemData: &armpolicyinsights.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:49:16.463Z"); return t}()),
// CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// CreatedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:50:18.464Z"); return t}()),
// LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// LastModifiedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// },
// },
// {
// Name: to.Ptr("0866f0cc-6cb3-422c-9fb6-a4e3e2266da8"),
// Type: to.Ptr("Microsoft.PolicyInsights/remediations"),
// ID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup2/providers/microsoft.policyinsights/remediations/0866f0cc-6cb3-422c-9fb6-a4e3e2266da8"),
// Properties: &armpolicyinsights.RemediationProperties{
// CorrelationID: to.Ptr("957378d3-a143-421e-8b0e-3048dff01932"),
// CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:49:16.463Z"); return t}()),
// DeploymentStatus: &armpolicyinsights.RemediationDeploymentSummary{
// FailedDeployments: to.Ptr[int32](0),
// SuccessfulDeployments: to.Ptr[int32](2),
// TotalDeployments: to.Ptr[int32](2),
// },
// FailureThreshold: &armpolicyinsights.RemediationPropertiesFailureThreshold{
// Percentage: to.Ptr[float32](0.1),
// },
// LastUpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:50:18.464Z"); return t}()),
// ParallelDeployments: to.Ptr[int32](6),
// PolicyAssignmentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
// ProvisioningState: to.Ptr("Succeeded"),
// ResourceCount: to.Ptr[int32](42),
// ResourceDiscoveryMode: to.Ptr(armpolicyinsights.ResourceDiscoveryModeExistingNonCompliant),
// StatusMessage: to.Ptr("Remediation extended status"),
// },
// SystemData: &armpolicyinsights.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:49:16.463Z"); return t}()),
// CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// CreatedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:50:18.464Z"); return t}()),
// LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// LastModifiedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PolicyInsightsClient } = require("@azure/arm-policyinsights");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets all remediations for the subscription.
*
* @summary Gets all remediations for the subscription.
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope.json
*/
async function listRemediationsAtSubscriptionScope() {
const subscriptionId =
process.env["POLICYINSIGHTS_SUBSCRIPTION_ID"] || "35ee058e-5fa0-414c-8145-3ebb8d09b6e2";
const credential = new DefaultAzureCredential();
const client = new PolicyInsightsClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.remediations.listForSubscription()) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"properties": {
"policyAssignmentId": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5",
"provisioningState": "Succeeded",
"createdOn": "2018-09-13T21:51:09.075918Z",
"lastUpdatedOn": "2018-09-13T21:52:10.0011706Z",
"resourceDiscoveryMode": "ExistingNonCompliant",
"deploymentStatus": {
"totalDeployments": 2,
"successfulDeployments": 2,
"failedDeployments": 0
},
"statusMessage": "Remediation extended status",
"correlationId": "a14e1d60-dae9-4771-b4be-a556d69e77a6",
"resourceCount": 42,
"parallelDeployments": 6,
"failureThreshold": {
"percentage": 0.1
}
},
"id": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.policyinsights/remediations/790996e6-9871-4b1f-9cd9-ec42cd6ced1e",
"name": "790996e6-9871-4b1f-9cd9-ec42cd6ced1e",
"type": "Microsoft.PolicyInsights/remediations",
"systemData": {
"createdBy": "b69a9388-9488-4534-b470-7ec6d41beef6",
"createdByType": "User",
"createdAt": "2018-09-13T21:49:16.4638131Z",
"lastModifiedBy": "b69a9388-9488-4534-b470-7ec6d41beef6",
"lastModifiedByType": "User",
"lastModifiedAt": "2018-09-13T21:50:18.4647478Z"
}
},
{
"properties": {
"policyAssignmentId": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5",
"provisioningState": "Succeeded",
"createdOn": "2018-09-13T21:49:16.4638131Z",
"lastUpdatedOn": "2018-09-13T21:50:18.4647478Z",
"resourceDiscoveryMode": "ExistingNonCompliant",
"deploymentStatus": {
"totalDeployments": 2,
"successfulDeployments": 2,
"failedDeployments": 0
},
"statusMessage": "Remediation extended status",
"correlationId": "957378d3-a143-421e-8b0e-3048dff01932",
"resourceCount": 42,
"parallelDeployments": 6,
"failureThreshold": {
"percentage": 0.1
}
},
"id": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup2/providers/microsoft.policyinsights/remediations/0866f0cc-6cb3-422c-9fb6-a4e3e2266da8",
"name": "0866f0cc-6cb3-422c-9fb6-a4e3e2266da8",
"type": "Microsoft.PolicyInsights/remediations",
"systemData": {
"createdBy": "b69a9388-9488-4534-b470-7ec6d41beef6",
"createdByType": "User",
"createdAt": "2018-09-13T21:49:16.4638131Z",
"lastModifiedBy": "b69a9388-9488-4534-b470-7ec6d41beef6",
"lastModifiedByType": "User",
"lastModifiedAt": "2018-09-13T21:50:18.4647478Z"
}
}
]
}
Sample Request
GET https://management.azure.com/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/Microsoft.PolicyInsights/remediations?$top=1&$filter=PolicyAssignmentId eq '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5' AND PolicyDefinitionReferenceId eq 'storageSkuDef'&api-version=2021-10-01
import com.azure.core.util.Context;
/** Samples for Remediations List. */
public final class Main {
/*
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope_WithQuery.json
*/
/**
* Sample code: List remediations at subscription scope with query parameters.
*
* @param manager Entry point to PolicyInsightsManager.
*/
public static void listRemediationsAtSubscriptionScopeWithQueryParameters(
com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) {
manager
.remediations()
.list(
1,
"PolicyAssignmentId eq"
+ " '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'"
+ " AND PolicyDefinitionReferenceId eq 'storageSkuDef'",
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.policyinsights import PolicyInsightsClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-policyinsights
# USAGE
python remediations_list_subscription_scope_with_query.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PolicyInsightsClient(
credential=DefaultAzureCredential(),
subscription_id="35ee058e-5fa0-414c-8145-3ebb8d09b6e2",
)
response = client.remediations.list_for_subscription()
for item in response:
print(item)
# x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope_WithQuery.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpolicyinsights_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/05a9cdab363b8ec824094ee73950c04594325172/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope_WithQuery.json
func ExampleRemediationsClient_NewListForSubscriptionPager_listRemediationsAtSubscriptionScopeWithQueryParameters() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpolicyinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewRemediationsClient().NewListForSubscriptionPager(&armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
Filter: to.Ptr("PolicyAssignmentId eq '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5' AND PolicyDefinitionReferenceId eq 'storageSkuDef'"),
OrderBy: nil,
Select: nil,
From: nil,
To: nil,
Apply: nil,
SkipToken: nil,
Expand: nil,
}, nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.RemediationListResult = armpolicyinsights.RemediationListResult{
// Value: []*armpolicyinsights.Remediation{
// {
// Name: to.Ptr("790996e6-9871-4b1f-9cd9-ec42cd6ced1e"),
// Type: to.Ptr("Microsoft.PolicyInsights/remediations"),
// ID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.policyinsights/remediations/790996e6-9871-4b1f-9cd9-ec42cd6ced1e"),
// Properties: &armpolicyinsights.RemediationProperties{
// CorrelationID: to.Ptr("a14e1d60-dae9-4771-b4be-a556d69e77a6"),
// CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:51:09.075Z"); return t}()),
// DeploymentStatus: &armpolicyinsights.RemediationDeploymentSummary{
// FailedDeployments: to.Ptr[int32](0),
// SuccessfulDeployments: to.Ptr[int32](2),
// TotalDeployments: to.Ptr[int32](2),
// },
// FailureThreshold: &armpolicyinsights.RemediationPropertiesFailureThreshold{
// Percentage: to.Ptr[float32](0.1),
// },
// LastUpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:52:10.001Z"); return t}()),
// ParallelDeployments: to.Ptr[int32](6),
// PolicyAssignmentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
// PolicyDefinitionReferenceID: to.Ptr("storageSkuDef"),
// ProvisioningState: to.Ptr("Succeeded"),
// ResourceCount: to.Ptr[int32](42),
// ResourceDiscoveryMode: to.Ptr(armpolicyinsights.ResourceDiscoveryModeExistingNonCompliant),
// StatusMessage: to.Ptr("Remediation extended status"),
// },
// SystemData: &armpolicyinsights.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:49:16.463Z"); return t}()),
// CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// CreatedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:50:18.464Z"); return t}()),
// LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// LastModifiedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// },
// },
// {
// Name: to.Ptr("0866f0cc-6cb3-422c-9fb6-a4e3e2266da8"),
// Type: to.Ptr("Microsoft.PolicyInsights/remediations"),
// ID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/rg2/providers/microsoft.policyinsights/remediations/0866f0cc-6cb3-422c-9fb6-a4e3e2266da8"),
// Properties: &armpolicyinsights.RemediationProperties{
// CorrelationID: to.Ptr("957378d3-a143-421e-8b0e-3048dff01932"),
// CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:49:16.463Z"); return t}()),
// DeploymentStatus: &armpolicyinsights.RemediationDeploymentSummary{
// FailedDeployments: to.Ptr[int32](0),
// SuccessfulDeployments: to.Ptr[int32](2),
// TotalDeployments: to.Ptr[int32](2),
// },
// LastUpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:50:18.464Z"); return t}()),
// PolicyAssignmentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
// PolicyDefinitionReferenceID: to.Ptr("storageSkuDef"),
// ProvisioningState: to.Ptr("Succeeded"),
// ResourceDiscoveryMode: to.Ptr(armpolicyinsights.ResourceDiscoveryModeExistingNonCompliant),
// StatusMessage: to.Ptr("Remediation extended status"),
// },
// SystemData: &armpolicyinsights.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:49:16.463Z"); return t}()),
// CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// CreatedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:50:18.464Z"); return t}()),
// LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// LastModifiedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PolicyInsightsClient } = require("@azure/arm-policyinsights");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets all remediations for the subscription.
*
* @summary Gets all remediations for the subscription.
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope_WithQuery.json
*/
async function listRemediationsAtSubscriptionScopeWithQueryParameters() {
const subscriptionId =
process.env["POLICYINSIGHTS_SUBSCRIPTION_ID"] || "35ee058e-5fa0-414c-8145-3ebb8d09b6e2";
const top = 1;
const filter =
"PolicyAssignmentId eq '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5' AND PolicyDefinitionReferenceId eq 'storageSkuDef'";
const options = {
queryOptions: { top: top, filter: filter },
};
const credential = new DefaultAzureCredential();
const client = new PolicyInsightsClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.remediations.listForSubscription(options)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"properties": {
"policyAssignmentId": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5",
"policyDefinitionReferenceId": "storageSkuDef",
"provisioningState": "Succeeded",
"createdOn": "2018-09-13T21:51:09.075918Z",
"lastUpdatedOn": "2018-09-13T21:52:10.0011706Z",
"resourceDiscoveryMode": "ExistingNonCompliant",
"deploymentStatus": {
"totalDeployments": 2,
"successfulDeployments": 2,
"failedDeployments": 0
},
"statusMessage": "Remediation extended status",
"correlationId": "a14e1d60-dae9-4771-b4be-a556d69e77a6",
"resourceCount": 42,
"parallelDeployments": 6,
"failureThreshold": {
"percentage": 0.1
}
},
"id": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.policyinsights/remediations/790996e6-9871-4b1f-9cd9-ec42cd6ced1e",
"name": "790996e6-9871-4b1f-9cd9-ec42cd6ced1e",
"type": "Microsoft.PolicyInsights/remediations",
"systemData": {
"createdBy": "b69a9388-9488-4534-b470-7ec6d41beef6",
"createdByType": "User",
"createdAt": "2018-09-13T21:49:16.4638131Z",
"lastModifiedBy": "b69a9388-9488-4534-b470-7ec6d41beef6",
"lastModifiedByType": "User",
"lastModifiedAt": "2018-09-13T21:50:18.4647478Z"
}
},
{
"properties": {
"policyAssignmentId": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5",
"policyDefinitionReferenceId": "storageSkuDef",
"provisioningState": "Succeeded",
"createdOn": "2018-09-13T21:49:16.4638131Z",
"lastUpdatedOn": "2018-09-13T21:50:18.4647478Z",
"resourceDiscoveryMode": "ExistingNonCompliant",
"deploymentStatus": {
"totalDeployments": 2,
"successfulDeployments": 2,
"failedDeployments": 0
},
"statusMessage": "Remediation extended status",
"correlationId": "957378d3-a143-421e-8b0e-3048dff01932"
},
"id": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/rg2/providers/microsoft.policyinsights/remediations/0866f0cc-6cb3-422c-9fb6-a4e3e2266da8",
"name": "0866f0cc-6cb3-422c-9fb6-a4e3e2266da8",
"type": "Microsoft.PolicyInsights/remediations",
"systemData": {
"createdBy": "b69a9388-9488-4534-b470-7ec6d41beef6",
"createdByType": "User",
"createdAt": "2018-09-13T21:49:16.4638131Z",
"lastModifiedBy": "b69a9388-9488-4534-b470-7ec6d41beef6",
"lastModifiedByType": "User",
"lastModifiedAt": "2018-09-13T21:50:18.4647478Z"
}
}
]
}
Definities
createdByType
Het type identiteit waarmee de resource is gemaakt.
Name |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorDefinition
Foutdefinitie.
Name |
Type |
Description |
additionalInfo
|
TypedErrorInfo[]
|
Aanvullende scenariospecifieke foutdetails.
|
code
|
string
|
Servicespecifieke foutcode die fungeert als de substatus voor de HTTP-foutcode.
|
details
|
ErrorDefinition[]
|
Interne foutdetails.
|
message
|
string
|
Beschrijving van de fout.
|
target
|
string
|
Het doel van de fout.
|
ErrorResponse
Foutreactie.
FailureThreshold
De instellingen voor de drempelwaarde voor herstelfouten
Name |
Type |
Description |
percentage
|
number
|
Een getal tussen 0,0 en 1,0 dat de drempelwaarde voor het percentage fouten aangeeft. Het herstel mislukt als het percentage mislukte herstelbewerkingen (dat wil zeggen mislukte implementaties) deze drempelwaarde overschrijdt.
|
De hersteldefinitie.
Name |
Type |
Description |
id
|
string
|
De id van het herstel.
|
name
|
string
|
De naam van het herstel.
|
properties.correlationId
|
string
|
De herstelcorrelatie-id. Kan worden gebruikt om gebeurtenissen te vinden die betrekking hebben op het herstel in het activiteitenlogboek.
|
properties.createdOn
|
string
|
Het tijdstip waarop het herstel is gemaakt.
|
properties.deploymentStatus
|
RemediationDeploymentSummary
|
Het overzicht van de implementatiestatus voor alle implementaties die door het herstel zijn gemaakt.
|
properties.failureThreshold
|
FailureThreshold
|
De instellingen voor de drempelwaarde voor herstelfouten
|
properties.filters
|
RemediationFilters
|
De filters die worden toegepast om te bepalen welke resources moeten worden hersteld.
|
properties.lastUpdatedOn
|
string
|
Het tijdstip waarop het herstel voor het laatst is bijgewerkt.
|
properties.parallelDeployments
|
integer
|
Bepaalt hoeveel resources er op een bepaald moment moeten worden hersteld. Kan worden gebruikt om het tempo van het herstel te verhogen of te verlagen. Als dit niet wordt opgegeven, wordt de standaardwaarde voor parallelle implementaties gebruikt.
|
properties.policyAssignmentId
|
string
|
De resource-id van de beleidstoewijzing die moet worden hersteld.
|
properties.policyDefinitionReferenceId
|
string
|
De referentie-id van de beleidsdefinitie van de afzonderlijke definitie die moet worden hersteld. Vereist wanneer de beleidstoewijzing die wordt hersteld, een definitie van een beleidsset toewijst.
|
properties.provisioningState
|
string
|
De status van het herstel. Dit verwijst naar de volledige hersteltaak, niet naar afzonderlijke implementaties. Toegestane waarden zijn Evalueren, Geannuleerd, Annuleren, Mislukt, Voltooid of Geslaagd.
|
properties.resourceCount
|
integer
|
Bepaalt het maximum aantal resources dat kan worden hersteld door de hersteltaak. Als dit niet wordt opgegeven, wordt het standaardaantal resources gebruikt.
|
properties.resourceDiscoveryMode
|
ResourceDiscoveryMode
|
De manier waarop resources worden gedetecteerd om te herstellen. De standaardinstelling is ExistingNonCompliant als deze niet is opgegeven.
|
properties.statusMessage
|
string
|
Het bericht over de herstelstatus. Biedt aanvullende informatie over de status van het herstel.
|
systemData
|
systemData
|
Azure Resource Manager metagegevens met informatie over createdBy en modifiedBy.
|
type
|
string
|
Het type herstel.
|
Het overzicht van de implementatiestatus voor alle implementaties die door het herstel zijn gemaakt.
Name |
Type |
Description |
failedDeployments
|
integer
|
Het aantal implementaties dat is vereist voor het herstel dat is mislukt.
|
successfulDeployments
|
integer
|
Het aantal implementaties dat is vereist voor het herstel dat is geslaagd.
|
totalDeployments
|
integer
|
Het aantal implementaties dat is vereist voor het herstel.
|
De filters die worden toegepast om te bepalen welke resources moeten worden hersteld.
Name |
Type |
Description |
locations
|
string[]
|
De resourcelocaties die worden hersteld.
|
Lijst met herstelbewerkingen.
Name |
Type |
Description |
nextLink
|
string
|
De URL voor het ophalen van de volgende set resultaten.
|
value
|
Remediation[]
|
Matrix met hersteldefinities.
|
ResourceDiscoveryMode
De manier waarop resources worden gedetecteerd om te herstellen. De standaardinstelling is ExistingNonCompliant als deze niet is opgegeven.
Name |
Type |
Description |
ExistingNonCompliant
|
string
|
Herstel resources die al niet compatibel zijn.
|
ReEvaluateCompliance
|
string
|
Evalueer de nalevingsstatus van resources opnieuw en herstel vervolgens de resources die niet-compatibel zijn.
|
systemData
Metagegevens met betrekking tot het maken en laatste wijzigen van de resource.
Name |
Type |
Description |
createdAt
|
string
|
De tijdstempel van het maken van resources (UTC).
|
createdBy
|
string
|
De identiteit die de resource heeft gemaakt.
|
createdByType
|
createdByType
|
Het type identiteit waarmee de resource is gemaakt.
|
lastModifiedAt
|
string
|
Het tijdstempel van de laatste wijziging van de resource (UTC)
|
lastModifiedBy
|
string
|
De identiteit die de resource het laatst heeft gewijzigd.
|
lastModifiedByType
|
createdByType
|
Het type identiteit dat de resource het laatst heeft gewijzigd.
|
TypedErrorInfo
Scenariospecifieke foutdetails.
Name |
Type |
Description |
info
|
|
De specifieke foutdetails van het scenario.
|
type
|
string
|
Het type opgenomen foutdetails.
|