Získá všechna nasazení pro nápravu v oboru skupiny prostředků.
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
Parametry identifikátoru URI
Name |
V |
Vyžadováno |
Typ |
Description |
remediationName
|
path |
True
|
string
|
Název nápravy.
|
resourceGroupName
|
path |
True
|
string
|
Název skupiny prostředků.
|
subscriptionId
|
path |
True
|
string
|
ID předplatného Microsoft Azure.
|
api-version
|
query |
True
|
string
|
Verze rozhraní API klienta.
|
$top
|
query |
|
integer
int32
|
Maximální počet záznamů, které se mají vrátit.
|
Odpovědi
Zabezpečení
azure_auth
Tok Azure Active Directory OAuth2
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
zosobnění uživatelského účtu
|
Příklady
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"
}
]
}
Definice
ErrorDefinition
Definice chyby
Name |
Typ |
Description |
additionalInfo
|
TypedErrorInfo[]
|
Další podrobnosti o chybách specifických pro konkrétní scénář
|
code
|
string
|
Kód chyby specifický pro službu, který slouží jako dílčí stav pro kód chyby HTTP.
|
details
|
ErrorDefinition[]
|
Podrobnosti o vnitřní chybě.
|
message
|
string
|
Popis chyby
|
target
|
string
|
Cíl chyby.
|
ErrorResponse
Odpověď na chybu.
Podrobnosti o jednom nasazení vytvořeném nápravou
Name |
Typ |
Description |
createdOn
|
string
|
Čas, ve kterém byla náprava vytvořena.
|
deploymentId
|
string
|
ID prostředku nasazení šablony, které prostředek opraví.
|
error
|
ErrorDefinition
|
Při nápravě prostředku došlo k chybě.
|
lastUpdatedOn
|
string
|
Čas poslední aktualizace nasazení nápravy.
|
remediatedResourceId
|
string
|
ID prostředku, který nasazení opravuje.
|
resourceLocation
|
string
|
Umístění prostředku, který se opravuje.
|
status
|
string
|
Stav nápravného nasazení.
|
Seznam nasazení pro nápravu
Name |
Typ |
Description |
nextLink
|
string
|
Adresa URL pro získání další sady výsledků
|
value
|
RemediationDeployment[]
|
Pole nasazení pro nápravu
|
TypedErrorInfo
Podrobnosti o chybách specifických pro scénář
Name |
Typ |
Description |
info
|
|
Podrobnosti o chybě specifické pro konkrétní scénář
|
type
|
string
|
Typ zahrnutých podrobností o chybě.
|