GetPolicyDefintion
Use this data source to access information about a Policy Definition, both custom and built in. Retrieves Policy Definitions from your current subscription by default.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var example = Output.Create(Azure.Policy.GetPolicyDefintion.InvokeAsync(new Azure.Policy.GetPolicyDefintionArgs
{
DisplayName = "Allowed resource types",
}));
this.Id = example.Apply(example => example.Id);
}
[Output("id")]
public Output<string> Id { get; set; }
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/policy"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
opt0 := "Allowed resource types"
example, err := policy.GetPolicyDefintion(ctx, &policy.GetPolicyDefintionArgs{
DisplayName: &opt0,
}, nil)
if err != nil {
return err
}
ctx.Export("id", example.Id)
return nil
})
}import pulumi
import pulumi_azure as azure
example = azure.policy.get_policy_defintion(display_name="Allowed resource types")
pulumi.export("id", example.id)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.policy.getPolicyDefintion({
displayName: "Allowed resource types",
});
export const id = example.then(example => example.id);Using GetPolicyDefintion
function getPolicyDefintion(args: GetPolicyDefintionArgs, opts?: InvokeOptions): Promise<GetPolicyDefintionResult>function get_policy_defintion(display_name=None, management_group_id=None, management_group_name=None, name=None, opts=None)func GetPolicyDefintion(ctx *Context, args *GetPolicyDefintionArgs, opts ...InvokeOption) (*GetPolicyDefintionResult, error)public static class GetPolicyDefintion {
public static Task<GetPolicyDefintionResult> InvokeAsync(GetPolicyDefintionArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Display
Name string Specifies the display name of the Policy Definition. Conflicts with
name.- Management
Group stringId - Management
Group stringName Only retrieve Policy Definitions from this Management Group.
- Name string
Specifies the name of the Policy Definition. Conflicts with
display_name.
- Display
Name string Specifies the display name of the Policy Definition. Conflicts with
name.- Management
Group stringId - Management
Group stringName Only retrieve Policy Definitions from this Management Group.
- Name string
Specifies the name of the Policy Definition. Conflicts with
display_name.
- display
Name string Specifies the display name of the Policy Definition. Conflicts with
name.- management
Group stringId - management
Group stringName Only retrieve Policy Definitions from this Management Group.
- name string
Specifies the name of the Policy Definition. Conflicts with
display_name.
- display_
name str Specifies the display name of the Policy Definition. Conflicts with
name.- management_
group_ strid - management_
group_ strname Only retrieve Policy Definitions from this Management Group.
- name str
Specifies the name of the Policy Definition. Conflicts with
display_name.
GetPolicyDefintion Result
The following output properties are available:
- Description string
The Description of the Policy.
- Display
Name string - Id string
The provider-assigned unique ID for this managed resource.
- Metadata string
Any Metadata defined in the Policy.
- Name string
- Parameters string
Any Parameters defined in the Policy.
- Policy
Rule string The Rule as defined (in JSON) in the Policy.
- Policy
Type string The Type of the Policy. Possible values are “BuiltIn”, “Custom” and “NotSpecified”.
- Type string
The Type of Policy.
- Management
Group stringId - Management
Group stringName
- Description string
The Description of the Policy.
- Display
Name string - Id string
The provider-assigned unique ID for this managed resource.
- Metadata string
Any Metadata defined in the Policy.
- Name string
- Parameters string
Any Parameters defined in the Policy.
- Policy
Rule string The Rule as defined (in JSON) in the Policy.
- Policy
Type string The Type of the Policy. Possible values are “BuiltIn”, “Custom” and “NotSpecified”.
- Type string
The Type of Policy.
- Management
Group stringId - Management
Group stringName
- description string
The Description of the Policy.
- display
Name string - id string
The provider-assigned unique ID for this managed resource.
- metadata string
Any Metadata defined in the Policy.
- name string
- parameters string
Any Parameters defined in the Policy.
- policy
Rule string The Rule as defined (in JSON) in the Policy.
- policy
Type string The Type of the Policy. Possible values are “BuiltIn”, “Custom” and “NotSpecified”.
- type string
The Type of Policy.
- management
Group stringId - management
Group stringName
- description str
The Description of the Policy.
- display_
name str - id str
The provider-assigned unique ID for this managed resource.
- metadata str
Any Metadata defined in the Policy.
- name str
- parameters str
Any Parameters defined in the Policy.
- policy_
rule str The Rule as defined (in JSON) in the Policy.
- policy_
type str The Type of the Policy. Possible values are “BuiltIn”, “Custom” and “NotSpecified”.
- type str
The Type of Policy.
- management_
group_ strid - management_
group_ strname
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.