Ottenere un elenco delle risorse dei metadati dei criteri.
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}
Parametri dell'URI
Nome |
In |
Necessario |
Tipo |
Descrizione |
api-version
|
query |
True
|
string
|
Versione dell'API client.
|
$top
|
query |
|
integer
int32
|
Numero massimo di record da restituire.
|
Risposte
Nome |
Tipo |
Descrizione |
200 OK
|
PolicyMetadataCollection
|
Raccolta di risorse dei metadati dei criteri.
|
Other Status Codes
|
ErrorResponse
|
Risposta di errore che descrive perché l'operazione non è riuscita.
|
Sicurezza
azure_auth
Flusso OAuth2 di Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nome |
Descrizione |
user_impersonation
|
rappresentare l'account utente
|
Esempio
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"
}
]
}
Definizioni
ErrorDefinition
Definizione di errore.
Nome |
Tipo |
Descrizione |
additionalInfo
|
TypedErrorInfo[]
|
Dettagli aggiuntivi sugli errori specifici dello scenario.
|
code
|
string
|
Codice di errore specifico del servizio che funge da sottostatus per il codice di errore HTTP.
|
details
|
ErrorDefinition[]
|
Dettagli dell'errore interno.
|
message
|
string
|
Descrizione dell'errore.
|
target
|
string
|
Destinazione dell'errore.
|
ErrorResponse
Risposta di errore.
Raccolta di risorse dei metadati dei criteri.
Nome |
Tipo |
Descrizione |
nextLink
|
string
|
URL per ottenere il set successivo di risultati.
|
value
|
SlimPolicyMetadata[]
|
Matrice di definizioni dei metadati dei criteri.
|
Versione sottile della definizione delle risorse dei metadati dei criteri, escluse le proprietà con stringhe di grandi dimensioni
Nome |
Tipo |
Descrizione |
id
|
string
|
ID dei metadati dei criteri.
|
name
|
string
|
Nome dei metadati dei criteri.
|
properties.additionalContentUrl
|
string
|
Url per ottenere contenuto aggiuntivo sui metadati delle risorse.
|
properties.category
|
string
|
Categoria dei metadati dei criteri.
|
properties.metadata
|
object
|
Metadati aggiuntivi.
|
properties.metadataId
|
string
|
Identificatore dei metadati dei criteri.
|
properties.owner
|
string
|
Proprietario dei metadati dei criteri.
|
properties.title
|
string
|
Titolo dei metadati dei criteri.
|
type
|
string
|
Tipo dei metadati dei criteri.
|
TypedErrorInfo
Dettagli degli errori specifici dello scenario.
Nome |
Tipo |
Descrizione |
info
|
|
Dettagli dell'errore specifico dello scenario.
|
type
|
string
|
Tipo di dettagli di errore inclusi.
|