Obtenez la liste des ressources de métadonnées de stratégie.
GET https://management.azure.com/providers/Microsoft.PolicyInsights/policyMetadata?api-version=2019-10-01
With optional parameters:
GET https://management.azure.com/providers/Microsoft.PolicyInsights/policyMetadata?api-version=2019-10-01&$top={$top}
Paramètres URI
Nom |
Dans |
Obligatoire |
Type |
Description |
api-version
|
query |
True
|
string
|
Version de l’API cliente.
|
$top
|
query |
|
integer
int32
|
Nombre maximal d’enregistrements à retourner.
|
Réponses
Nom |
Type |
Description |
200 OK
|
PolicyMetadataCollection
|
Collection de ressources de métadonnées de stratégie.
|
Other Status Codes
|
ErrorResponse
|
Réponse d’erreur décrivant la raison de l’échec de l’opération.
|
Sécurité
azure_auth
Flux OAuth2 Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nom |
Description |
user_impersonation
|
Emprunter l’identité de votre compte d’utilisateur
|
Exemples
Sample Request
GET https://management.azure.com/providers/Microsoft.PolicyInsights/policyMetadata?api-version=2019-10-01
import com.azure.core.util.Context;
/** Samples for PolicyMetadata List. */
public final class Main {
/*
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List.json
*/
/**
* Sample code: Get collection of policy metadata resources.
*
* @param manager Entry point to PolicyInsightsManager.
*/
public static void getCollectionOfPolicyMetadataResources(
com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) {
manager.policyMetadatas().list(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 policy_metadata_list.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="SUBSCRIPTION_ID",
)
response = client.policy_metadata.list()
for item in response:
print(item)
# x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List.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/2019-10-01/examples/PolicyMetadata_List.json
func ExamplePolicyMetadataClient_NewListPager_getCollectionOfPolicyMetadataResources() {
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.NewPolicyMetadataClient().NewListPager(&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.PolicyMetadataCollection = armpolicyinsights.PolicyMetadataCollection{
// Value: []*armpolicyinsights.SlimPolicyMetadata{
// {
// Name: to.Ptr("NIST_SP_800-53_R4_AC-2"),
// Type: to.Ptr("Microsoft.PolicyInsights/policyMetadata"),
// ID: to.Ptr("/providers/Microsoft.PolicyInsights/policyMetadata/NIST_SP_800-53_R4_AC-2"),
// Properties: &armpolicyinsights.PolicyMetadataSlimProperties{
// AdditionalContentURL: to.Ptr("https://aka.ms/NIST_SP_800-53_R4_AC-2"),
// Category: to.Ptr("Access control"),
// Metadata: map[string]any{
// },
// MetadataID: to.Ptr("NIST SP 800-53 R4 AC-2"),
// Owner: to.Ptr("Shared"),
// Title: to.Ptr("Account Management"),
// },
// }},
// }
}
}
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 Get a list of the policy metadata resources.
*
* @summary Get a list of the policy metadata resources.
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List.json
*/
async function getCollectionOfPolicyMetadataResources() {
const subscriptionId =
process.env["POLICYINSIGHTS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new PolicyInsightsClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.policyMetadataOperations.list()) {
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
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.PolicyInsights;
using Azure.ResourceManager.PolicyInsights.Models;
// Generated from example definition: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List.json
// this example is just showing the usage of "PolicyMetadata_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this TenantResource created on azure
// for more information of creating TenantResource, please refer to the document of TenantResource
var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current;
// get the collection of this PolicyMetadataResource
PolicyMetadataCollection collection = tenantResource.GetAllPolicyMetadata();
// invoke the operation and iterate over the result
await foreach (SlimPolicyMetadata item in collection.GetAllAsync())
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine($"Succeeded");
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": {
"metadataId": "NIST SP 800-53 R4 AC-2",
"category": "Access control",
"title": "Account Management",
"owner": "Shared",
"additionalContentUrl": "https://aka.ms/NIST_SP_800-53_R4_AC-2",
"metadata": {}
},
"id": "/providers/Microsoft.PolicyInsights/policyMetadata/NIST_SP_800-53_R4_AC-2",
"name": "NIST_SP_800-53_R4_AC-2",
"type": "Microsoft.PolicyInsights/policyMetadata"
}
]
}
Sample Request
GET https://management.azure.com/providers/Microsoft.PolicyInsights/policyMetadata?api-version=2019-10-01&$top=1
import com.azure.core.util.Context;
/** Samples for PolicyMetadata List. */
public final class Main {
/*
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List_WithTop.json
*/
/**
* Sample code: Get collection of policy metadata resources using top query parameter.
*
* @param manager Entry point to PolicyInsightsManager.
*/
public static void getCollectionOfPolicyMetadataResourcesUsingTopQueryParameter(
com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager) {
manager.policyMetadatas().list(1, 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 policy_metadata_list_with_top.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="SUBSCRIPTION_ID",
)
response = client.policy_metadata.list()
for item in response:
print(item)
# x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List_WithTop.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/2019-10-01/examples/PolicyMetadata_List_WithTop.json
func ExamplePolicyMetadataClient_NewListPager_getCollectionOfPolicyMetadataResourcesUsingTopQueryParameter() {
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.NewPolicyMetadataClient().NewListPager(&armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
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.PolicyMetadataCollection = armpolicyinsights.PolicyMetadataCollection{
// Value: []*armpolicyinsights.SlimPolicyMetadata{
// {
// Name: to.Ptr("NIST_SP_800-53_R4_AC-2"),
// Type: to.Ptr("Microsoft.PolicyInsights/policyMetadata"),
// ID: to.Ptr("/providers/Microsoft.PolicyInsights/policyMetadata/NIST_SP_800-53_R4_AC-2"),
// Properties: &armpolicyinsights.PolicyMetadataSlimProperties{
// AdditionalContentURL: to.Ptr("https://aka.ms/NIST_SP_800-53_R4_AC-2"),
// Category: to.Ptr("Access control"),
// Metadata: map[string]any{
// },
// MetadataID: to.Ptr("NIST SP 800-53 R4 AC-2"),
// Owner: to.Ptr("Shared"),
// Title: to.Ptr("Account Management"),
// },
// }},
// }
}
}
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 Get a list of the policy metadata resources.
*
* @summary Get a list of the policy metadata resources.
* x-ms-original-file: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List_WithTop.json
*/
async function getCollectionOfPolicyMetadataResourcesUsingTopQueryParameter() {
const subscriptionId =
process.env["POLICYINSIGHTS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const top = 1;
const options = { queryOptions: { top: top } };
const credential = new DefaultAzureCredential();
const client = new PolicyInsightsClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.policyMetadataOperations.list(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
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.PolicyInsights;
using Azure.ResourceManager.PolicyInsights.Models;
// Generated from example definition: specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List_WithTop.json
// this example is just showing the usage of "PolicyMetadata_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this TenantResource created on azure
// for more information of creating TenantResource, please refer to the document of TenantResource
var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current;
// get the collection of this PolicyMetadataResource
PolicyMetadataCollection collection = tenantResource.GetAllPolicyMetadata();
// invoke the operation and iterate over the result
await foreach (SlimPolicyMetadata item in collection.GetAllAsync())
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine($"Succeeded");
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": {
"metadataId": "NIST SP 800-53 R4 AC-2",
"category": "Access control",
"title": "Account Management",
"owner": "Shared",
"additionalContentUrl": "https://aka.ms/NIST_SP_800-53_R4_AC-2",
"metadata": {}
},
"id": "/providers/Microsoft.PolicyInsights/policyMetadata/NIST_SP_800-53_R4_AC-2",
"name": "NIST_SP_800-53_R4_AC-2",
"type": "Microsoft.PolicyInsights/policyMetadata"
}
]
}
Définitions
ErrorDefinition
Définition de l’erreur.
Nom |
Type |
Description |
additionalInfo
|
TypedErrorInfo[]
|
Détails d’erreur supplémentaires spécifiques au scénario.
|
code
|
string
|
Code d’erreur spécifique au service qui sert de sous-état pour le code d’erreur HTTP.
|
details
|
ErrorDefinition[]
|
Détails de l’erreur interne.
|
message
|
string
|
Description de l'erreur.
|
target
|
string
|
Cible de l’erreur.
|
ErrorResponse
Réponse d’erreur.
Collection de ressources de métadonnées de stratégie.
Nom |
Type |
Description |
nextLink
|
string
|
URL permettant d’obtenir l’ensemble de résultats suivant.
|
value
|
SlimPolicyMetadata[]
|
Tableau de définitions de métadonnées de stratégie.
|
Version allégée de la définition de ressource de métadonnées de stratégie, à l’exclusion des propriétés avec des chaînes volumineuses
Nom |
Type |
Description |
id
|
string
|
ID des métadonnées de stratégie.
|
name
|
string
|
Nom des métadonnées de stratégie.
|
properties.additionalContentUrl
|
string
|
URL pour obtenir du contenu supplémentaire sur les métadonnées de ressource.
|
properties.category
|
string
|
Catégorie des métadonnées de stratégie.
|
properties.metadata
|
object
|
Métadonnées supplémentaires.
|
properties.metadataId
|
string
|
Identificateur de métadonnées de stratégie.
|
properties.owner
|
string
|
Propriétaire des métadonnées de stratégie.
|
properties.title
|
string
|
Titre des métadonnées de stratégie.
|
type
|
string
|
Type des métadonnées de stratégie.
|
TypedErrorInfo
Détails de l’erreur spécifique au scénario.
Nom |
Type |
Description |
info
|
|
Détails de l’erreur spécifique au scénario.
|
type
|
string
|
Type de détails d’erreur inclus.
|