Get a list of the policy metadata resources.
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}
URI Parameters
Name |
In |
Required |
Type |
Description |
api-version
|
query |
True
|
string
|
Client Api Version.
|
$top
|
query |
|
integer
int32
|
Maximum number of records to return.
|
Responses
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
Sample request
GET https://management.azure.com/providers/Microsoft.PolicyInsights/policyMetadata?api-version=2019-10-01
/**
* 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, com.azure.core.util.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://video2.skills-academy.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
/**
* 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, com.azure.core.util.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://video2.skills-academy.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"
}
]
}
Definitions
ErrorDefinition
Error definition.
Name |
Type |
Description |
additionalInfo
|
TypedErrorInfo[]
|
Additional scenario specific error details.
|
code
|
string
|
Service specific error code which serves as the substatus for the HTTP error code.
|
details
|
ErrorDefinition[]
|
Internal error details.
|
message
|
string
|
Description of the error.
|
target
|
string
|
The target of the error.
|
ErrorResponse
Error response.
Collection of policy metadata resources.
Name |
Type |
Description |
nextLink
|
string
|
The URL to get the next set of results.
|
value
|
SlimPolicyMetadata[]
|
Array of policy metadata definitions.
|
Slim version of policy metadata resource definition, excluding properties with large strings
Name |
Type |
Description |
id
|
string
|
The ID of the policy metadata.
|
name
|
string
|
The name of the policy metadata.
|
properties.additionalContentUrl
|
string
|
Url for getting additional content about the resource metadata.
|
properties.category
|
string
|
The category of the policy metadata.
|
properties.metadata
|
object
|
Additional metadata.
|
properties.metadataId
|
string
|
The policy metadata identifier.
|
properties.owner
|
string
|
The owner of the policy metadata.
|
properties.title
|
string
|
The title of the policy metadata.
|
type
|
string
|
The type of the policy metadata.
|
TypedErrorInfo
Scenario specific error details.
Name |
Type |
Description |
info
|
|
The scenario specific error details.
|
type
|
string
|
The type of included error details.
|