Hiermee haalt u alle implementaties op voor een herstel binnen het bereik van de resourcegroep.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments?api-version=2021-10-01
With optional parameters:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments?$top={$top}&api-version=2021-10-01
URI-parameters
Name |
In |
Vereist |
Type |
Description |
remediationName
|
path |
True
|
string
|
De naam van het herstel.
|
resourceGroupName
|
path |
True
|
string
|
Naam van de resourcegroep.
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure-abonnements-id.
|
api-version
|
query |
True
|
string
|
Client-API-versie.
|
$top
|
query |
|
integer
int32
|
Maximum aantal records dat moet worden geretourneerd.
|
Antwoorden
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
POST https://management.azure.com/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/Microsoft.PolicyInsights/remediations/myRemediation/listDeployments?api-version=2021-10-01
import com.azure.core.util.Context;
/** Samples for Remediations ListDeploymentsAtResourceGroup. */
public final class Main {
/*
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsResourceGroupScope.json
*/
/**
* Sample code: List deployments for a remediation at resource group scope.
*
* @param manager Entry point to PolicyInsightsManager.
*/
public static void listDeploymentsForARemediationAtResourceGroupScope(
com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) {
manager.remediations().listDeploymentsAtResourceGroup("myResourceGroup", "myRemediation", 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_deployments_resource_group_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_deployments_at_resource_group(
resource_group_name="myResourceGroup",
remediation_name="myRemediation",
)
for item in response:
print(item)
# x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsResourceGroupScope.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_ListDeploymentsResourceGroupScope.json
func ExampleRemediationsClient_NewListDeploymentsAtResourceGroupPager() {
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().NewListDeploymentsAtResourceGroupPager("myResourceGroup", "myRemediation", &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.RemediationDeploymentsListResult = armpolicyinsights.RemediationDeploymentsListResult{
// Value: []*armpolicyinsights.RemediationDeployment{
// {
// CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:51:09.075Z"); return t}()),
// DeploymentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.resources/deployments/a088e8fd-8600-4126-8d74-fc7ead0e9ae4"),
// LastUpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:52:09.891Z"); return t}()),
// RemediatedResourceID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1"),
// ResourceLocation: to.Ptr("eastus"),
// Status: to.Ptr("Succeeded"),
// },
// {
// CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:51:09.075Z"); return t}()),
// DeploymentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.resources/deployments/6b8898c0-18a2-449e-987a-8d4d4f634f56"),
// LastUpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T21:52:09.876Z"); return t}()),
// RemediatedResourceID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/stor2"),
// ResourceLocation: to.Ptr("westus"),
// Status: to.Ptr("Succeeded"),
// }},
// }
}
}
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 deployments for a remediation at resource group scope.
*
* @summary Gets all deployments for a remediation at resource group scope.
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsResourceGroupScope.json
*/
async function listDeploymentsForARemediationAtResourceGroupScope() {
const subscriptionId =
process.env["POLICYINSIGHTS_SUBSCRIPTION_ID"] || "35ee058e-5fa0-414c-8145-3ebb8d09b6e2";
const resourceGroupName = process.env["POLICYINSIGHTS_RESOURCE_GROUP"] || "myResourceGroup";
const remediationName = "myRemediation";
const credential = new DefaultAzureCredential();
const client = new PolicyInsightsClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.remediations.listDeploymentsAtResourceGroup(
resourceGroupName,
remediationName
)) {
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": [
{
"remediatedResourceId": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1",
"deploymentId": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.resources/deployments/a088e8fd-8600-4126-8d74-fc7ead0e9ae4",
"status": "Succeeded",
"resourceLocation": "eastus",
"createdOn": "2018-09-13T21:51:09.075918Z",
"lastUpdatedOn": "2018-09-13T21:52:09.8919106Z"
},
{
"remediatedResourceId": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/stor2",
"deploymentId": "/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.resources/deployments/6b8898c0-18a2-449e-987a-8d4d4f634f56",
"status": "Succeeded",
"resourceLocation": "westus",
"createdOn": "2018-09-13T21:51:09.075918Z",
"lastUpdatedOn": "2018-09-13T21:52:09.8761679Z"
}
]
}
Definities
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.
Details van één implementatie die door het herstel is gemaakt.
Name |
Type |
Description |
createdOn
|
string
|
Het tijdstip waarop het herstel is gemaakt.
|
deploymentId
|
string
|
Resource-id van de sjabloonimplementatie waarmee de resource wordt hersteld.
|
error
|
ErrorDefinition
|
Er is een fout opgetreden tijdens het herstellen van de resource.
|
lastUpdatedOn
|
string
|
Het tijdstip waarop de herstelimplementatie voor het laatst is bijgewerkt.
|
remediatedResourceId
|
string
|
Resource-id van de resource die door de implementatie wordt hersteld.
|
resourceLocation
|
string
|
Locatie van de resource die wordt hersteld.
|
status
|
string
|
Status van de herstelimplementatie.
|
Lijst met implementaties voor een herstel.
Name |
Type |
Description |
nextLink
|
string
|
De URL voor het ophalen van de volgende set resultaten.
|
value
|
RemediationDeployment[]
|
Matrix van implementaties voor het herstel.
|
TypedErrorInfo
Scenariospecifieke foutdetails.
Name |
Type |
Description |
info
|
|
De specifieke foutdetails van het scenario.
|
type
|
string
|
Het type opgenomen foutdetails.
|