1. Packages
  2. Azure Native v2
  3. API Docs
  4. devtestlab
  5. Policy
These are the docs for Azure Native v2. We recommenend using the latest version, Azure Native v3.
Azure Native v2 v2.90.0 published on Thursday, Mar 27, 2025 by Pulumi

azure-native-v2.devtestlab.Policy

Explore with Pulumi AI

These are the docs for Azure Native v2. We recommenend using the latest version, Azure Native v3.
Azure Native v2 v2.90.0 published on Thursday, Mar 27, 2025 by Pulumi

A Policy. Azure REST API version: 2018-09-15. Prior API version in Azure Native 1.x: 2018-09-15.

Example Usage

Policies_CreateOrUpdate

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var policy = new AzureNative.DevTestLab.Policy("policy", new()
    {
        Description = "{policyDescription}",
        EvaluatorType = "{policyEvaluatorType}",
        FactData = "{policyFactData}",
        FactName = "{policyFactName}",
        LabName = "{labName}",
        Location = "{location}",
        Name = "{policyName}",
        PolicySetName = "{policySetName}",
        ResourceGroupName = "resourceGroupName",
        Status = "{policyStatus}",
        Tags = 
        {
            { "tagName1", "tagValue1" },
        },
        Threshold = "{policyThreshold}",
    });

});
Copy
package main

import (
	devtestlab "github.com/pulumi/pulumi-azure-native-sdk/devtestlab/v2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := devtestlab.NewPolicy(ctx, "policy", &devtestlab.PolicyArgs{
			Description:       pulumi.String("{policyDescription}"),
			EvaluatorType:     pulumi.String("{policyEvaluatorType}"),
			FactData:          pulumi.String("{policyFactData}"),
			FactName:          pulumi.String("{policyFactName}"),
			LabName:           pulumi.String("{labName}"),
			Location:          pulumi.String("{location}"),
			Name:              pulumi.String("{policyName}"),
			PolicySetName:     pulumi.String("{policySetName}"),
			ResourceGroupName: pulumi.String("resourceGroupName"),
			Status:            pulumi.String("{policyStatus}"),
			Tags: pulumi.StringMap{
				"tagName1": pulumi.String("tagValue1"),
			},
			Threshold: pulumi.String("{policyThreshold}"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.devtestlab.Policy;
import com.pulumi.azurenative.devtestlab.PolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var policy = new Policy("policy", PolicyArgs.builder()
            .description("{policyDescription}")
            .evaluatorType("{policyEvaluatorType}")
            .factData("{policyFactData}")
            .factName("{policyFactName}")
            .labName("{labName}")
            .location("{location}")
            .name("{policyName}")
            .policySetName("{policySetName}")
            .resourceGroupName("resourceGroupName")
            .status("{policyStatus}")
            .tags(Map.of("tagName1", "tagValue1"))
            .threshold("{policyThreshold}")
            .build());

    }
}
Copy
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const policy = new azure_native.devtestlab.Policy("policy", {
    description: "{policyDescription}",
    evaluatorType: "{policyEvaluatorType}",
    factData: "{policyFactData}",
    factName: "{policyFactName}",
    labName: "{labName}",
    location: "{location}",
    name: "{policyName}",
    policySetName: "{policySetName}",
    resourceGroupName: "resourceGroupName",
    status: "{policyStatus}",
    tags: {
        tagName1: "tagValue1",
    },
    threshold: "{policyThreshold}",
});
Copy
import pulumi
import pulumi_azure_native as azure_native

policy = azure_native.devtestlab.Policy("policy",
    description="{policyDescription}",
    evaluator_type="{policyEvaluatorType}",
    fact_data="{policyFactData}",
    fact_name="{policyFactName}",
    lab_name="{labName}",
    location="{location}",
    name="{policyName}",
    policy_set_name="{policySetName}",
    resource_group_name="resourceGroupName",
    status="{policyStatus}",
    tags={
        "tagName1": "tagValue1",
    },
    threshold="{policyThreshold}")
Copy
resources:
  policy:
    type: azure-native:devtestlab:Policy
    properties:
      description: '{policyDescription}'
      evaluatorType: '{policyEvaluatorType}'
      factData: '{policyFactData}'
      factName: '{policyFactName}'
      labName: '{labName}'
      location: '{location}'
      name: '{policyName}'
      policySetName: '{policySetName}'
      resourceGroupName: resourceGroupName
      status: '{policyStatus}'
      tags:
        tagName1: tagValue1
      threshold: '{policyThreshold}'
Copy

Create Policy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);
@overload
def Policy(resource_name: str,
           args: PolicyArgs,
           opts: Optional[ResourceOptions] = None)

@overload
def Policy(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           lab_name: Optional[str] = None,
           policy_set_name: Optional[str] = None,
           resource_group_name: Optional[str] = None,
           description: Optional[str] = None,
           evaluator_type: Optional[Union[str, PolicyEvaluatorType]] = None,
           fact_data: Optional[str] = None,
           fact_name: Optional[Union[str, PolicyFactName]] = None,
           location: Optional[str] = None,
           name: Optional[str] = None,
           status: Optional[Union[str, PolicyStatus]] = None,
           tags: Optional[Mapping[str, str]] = None,
           threshold: Optional[str] = None)
func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: azure-native:devtestlab:Policy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var examplepolicyResourceResourceFromDevtestlab = new AzureNative.Devtestlab.Policy("examplepolicyResourceResourceFromDevtestlab", new()
{
    LabName = "string",
    PolicySetName = "string",
    ResourceGroupName = "string",
    Description = "string",
    EvaluatorType = "string",
    FactData = "string",
    FactName = "string",
    Location = "string",
    Name = "string",
    Status = "string",
    Tags = 
    {
        { "string", "string" },
    },
    Threshold = "string",
});
Copy
example, err := devtestlab.NewPolicy(ctx, "examplepolicyResourceResourceFromDevtestlab", &devtestlab.PolicyArgs{
	LabName:           "string",
	PolicySetName:     "string",
	ResourceGroupName: "string",
	Description:       "string",
	EvaluatorType:     "string",
	FactData:          "string",
	FactName:          "string",
	Location:          "string",
	Name:              "string",
	Status:            "string",
	Tags: map[string]interface{}{
		"string": "string",
	},
	Threshold: "string",
})
Copy
var examplepolicyResourceResourceFromDevtestlab = new com.pulumi.azurenative.devtestlab.Policy("examplepolicyResourceResourceFromDevtestlab", com.pulumi.azurenative.devtestlab.PolicyArgs.builder()
    .labName("string")
    .policySetName("string")
    .resourceGroupName("string")
    .description("string")
    .evaluatorType("string")
    .factData("string")
    .factName("string")
    .location("string")
    .name("string")
    .status("string")
    .tags(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
    .threshold("string")
    .build());
Copy
examplepolicy_resource_resource_from_devtestlab = azure_native.devtestlab.Policy("examplepolicyResourceResourceFromDevtestlab",
    lab_name=string,
    policy_set_name=string,
    resource_group_name=string,
    description=string,
    evaluator_type=string,
    fact_data=string,
    fact_name=string,
    location=string,
    name=string,
    status=string,
    tags={
        string: string,
    },
    threshold=string)
Copy
const examplepolicyResourceResourceFromDevtestlab = new azure_native.devtestlab.Policy("examplepolicyResourceResourceFromDevtestlab", {
    labName: "string",
    policySetName: "string",
    resourceGroupName: "string",
    description: "string",
    evaluatorType: "string",
    factData: "string",
    factName: "string",
    location: "string",
    name: "string",
    status: "string",
    tags: {
        string: "string",
    },
    threshold: "string",
});
Copy
type: azure-native:devtestlab:Policy
properties:
    description: string
    evaluatorType: string
    factData: string
    factName: string
    labName: string
    location: string
    name: string
    policySetName: string
    resourceGroupName: string
    status: string
    tags:
        string: string
    threshold: string
Copy

Policy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Policy resource accepts the following input properties:

LabName
This property is required.
Changes to this property will trigger replacement.
string
The name of the lab.
PolicySetName
This property is required.
Changes to this property will trigger replacement.
string
The name of the policy set.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group.
Description string
The description of the policy.
EvaluatorType string | Pulumi.AzureNative.DevTestLab.PolicyEvaluatorType
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy).
FactData string
The fact data of the policy.
FactName string | Pulumi.AzureNative.DevTestLab.PolicyFactName
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.
Location string
The location of the resource.
Name Changes to this property will trigger replacement. string
The name of the policy.
Status string | Pulumi.AzureNative.DevTestLab.PolicyStatus
The status of the policy.
Tags Dictionary<string, string>
The tags of the resource.
Threshold string
The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy).
LabName
This property is required.
Changes to this property will trigger replacement.
string
The name of the lab.
PolicySetName
This property is required.
Changes to this property will trigger replacement.
string
The name of the policy set.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group.
Description string
The description of the policy.
EvaluatorType string | PolicyEvaluatorType
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy).
FactData string
The fact data of the policy.
FactName string | PolicyFactName
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.
Location string
The location of the resource.
Name Changes to this property will trigger replacement. string
The name of the policy.
Status string | PolicyStatus
The status of the policy.
Tags map[string]string
The tags of the resource.
Threshold string
The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy).
labName
This property is required.
Changes to this property will trigger replacement.
String
The name of the lab.
policySetName
This property is required.
Changes to this property will trigger replacement.
String
The name of the policy set.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group.
description String
The description of the policy.
evaluatorType String | PolicyEvaluatorType
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy).
factData String
The fact data of the policy.
factName String | PolicyFactName
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.
location String
The location of the resource.
name Changes to this property will trigger replacement. String
The name of the policy.
status String | PolicyStatus
The status of the policy.
tags Map<String,String>
The tags of the resource.
threshold String
The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy).
labName
This property is required.
Changes to this property will trigger replacement.
string
The name of the lab.
policySetName
This property is required.
Changes to this property will trigger replacement.
string
The name of the policy set.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group.
description string
The description of the policy.
evaluatorType string | PolicyEvaluatorType
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy).
factData string
The fact data of the policy.
factName string | PolicyFactName
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.
location string
The location of the resource.
name Changes to this property will trigger replacement. string
The name of the policy.
status string | PolicyStatus
The status of the policy.
tags {[key: string]: string}
The tags of the resource.
threshold string
The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy).
lab_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the lab.
policy_set_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the policy set.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group.
description str
The description of the policy.
evaluator_type str | PolicyEvaluatorType
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy).
fact_data str
The fact data of the policy.
fact_name str | PolicyFactName
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.
location str
The location of the resource.
name Changes to this property will trigger replacement. str
The name of the policy.
status str | PolicyStatus
The status of the policy.
tags Mapping[str, str]
The tags of the resource.
threshold str
The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy).
labName
This property is required.
Changes to this property will trigger replacement.
String
The name of the lab.
policySetName
This property is required.
Changes to this property will trigger replacement.
String
The name of the policy set.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group.
description String
The description of the policy.
evaluatorType String | "AllowedValuesPolicy" | "MaxValuePolicy"
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy).
factData String
The fact data of the policy.
factName String | "UserOwnedLabVmCount" | "UserOwnedLabPremiumVmCount" | "LabVmCount" | "LabPremiumVmCount" | "LabVmSize" | "GalleryImage" | "UserOwnedLabVmCountInSubnet" | "LabTargetCost" | "EnvironmentTemplate" | "ScheduleEditPermission"
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.
location String
The location of the resource.
name Changes to this property will trigger replacement. String
The name of the policy.
status String | "Enabled" | "Disabled"
The status of the policy.
tags Map<String>
The tags of the resource.
threshold String
The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy).

Outputs

All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:

CreatedDate string
The creation date of the policy.
Id string
The provider-assigned unique ID for this managed resource.
ProvisioningState string
The provisioning status of the resource.
Type string
The type of the resource.
UniqueIdentifier string
The unique immutable identifier of a resource (Guid).
CreatedDate string
The creation date of the policy.
Id string
The provider-assigned unique ID for this managed resource.
ProvisioningState string
The provisioning status of the resource.
Type string
The type of the resource.
UniqueIdentifier string
The unique immutable identifier of a resource (Guid).
createdDate String
The creation date of the policy.
id String
The provider-assigned unique ID for this managed resource.
provisioningState String
The provisioning status of the resource.
type String
The type of the resource.
uniqueIdentifier String
The unique immutable identifier of a resource (Guid).
createdDate string
The creation date of the policy.
id string
The provider-assigned unique ID for this managed resource.
provisioningState string
The provisioning status of the resource.
type string
The type of the resource.
uniqueIdentifier string
The unique immutable identifier of a resource (Guid).
created_date str
The creation date of the policy.
id str
The provider-assigned unique ID for this managed resource.
provisioning_state str
The provisioning status of the resource.
type str
The type of the resource.
unique_identifier str
The unique immutable identifier of a resource (Guid).
createdDate String
The creation date of the policy.
id String
The provider-assigned unique ID for this managed resource.
provisioningState String
The provisioning status of the resource.
type String
The type of the resource.
uniqueIdentifier String
The unique immutable identifier of a resource (Guid).

Supporting Types

PolicyEvaluatorType
, PolicyEvaluatorTypeArgs

AllowedValuesPolicy
AllowedValuesPolicy
MaxValuePolicy
MaxValuePolicy
PolicyEvaluatorTypeAllowedValuesPolicy
AllowedValuesPolicy
PolicyEvaluatorTypeMaxValuePolicy
MaxValuePolicy
AllowedValuesPolicy
AllowedValuesPolicy
MaxValuePolicy
MaxValuePolicy
AllowedValuesPolicy
AllowedValuesPolicy
MaxValuePolicy
MaxValuePolicy
ALLOWED_VALUES_POLICY
AllowedValuesPolicy
MAX_VALUE_POLICY
MaxValuePolicy
"AllowedValuesPolicy"
AllowedValuesPolicy
"MaxValuePolicy"
MaxValuePolicy

PolicyFactName
, PolicyFactNameArgs

UserOwnedLabVmCount
UserOwnedLabVmCount
UserOwnedLabPremiumVmCount
UserOwnedLabPremiumVmCount
LabVmCount
LabVmCount
LabPremiumVmCount
LabPremiumVmCount
LabVmSize
LabVmSize
GalleryImage
GalleryImage
UserOwnedLabVmCountInSubnet
UserOwnedLabVmCountInSubnet
LabTargetCost
LabTargetCost
EnvironmentTemplate
EnvironmentTemplate
ScheduleEditPermission
ScheduleEditPermission
PolicyFactNameUserOwnedLabVmCount
UserOwnedLabVmCount
PolicyFactNameUserOwnedLabPremiumVmCount
UserOwnedLabPremiumVmCount
PolicyFactNameLabVmCount
LabVmCount
PolicyFactNameLabPremiumVmCount
LabPremiumVmCount
PolicyFactNameLabVmSize
LabVmSize
PolicyFactNameGalleryImage
GalleryImage
PolicyFactNameUserOwnedLabVmCountInSubnet
UserOwnedLabVmCountInSubnet
PolicyFactNameLabTargetCost
LabTargetCost
PolicyFactNameEnvironmentTemplate
EnvironmentTemplate
PolicyFactNameScheduleEditPermission
ScheduleEditPermission
UserOwnedLabVmCount
UserOwnedLabVmCount
UserOwnedLabPremiumVmCount
UserOwnedLabPremiumVmCount
LabVmCount
LabVmCount
LabPremiumVmCount
LabPremiumVmCount
LabVmSize
LabVmSize
GalleryImage
GalleryImage
UserOwnedLabVmCountInSubnet
UserOwnedLabVmCountInSubnet
LabTargetCost
LabTargetCost
EnvironmentTemplate
EnvironmentTemplate
ScheduleEditPermission
ScheduleEditPermission
UserOwnedLabVmCount
UserOwnedLabVmCount
UserOwnedLabPremiumVmCount
UserOwnedLabPremiumVmCount
LabVmCount
LabVmCount
LabPremiumVmCount
LabPremiumVmCount
LabVmSize
LabVmSize
GalleryImage
GalleryImage
UserOwnedLabVmCountInSubnet
UserOwnedLabVmCountInSubnet
LabTargetCost
LabTargetCost
EnvironmentTemplate
EnvironmentTemplate
ScheduleEditPermission
ScheduleEditPermission
USER_OWNED_LAB_VM_COUNT
UserOwnedLabVmCount
USER_OWNED_LAB_PREMIUM_VM_COUNT
UserOwnedLabPremiumVmCount
LAB_VM_COUNT
LabVmCount
LAB_PREMIUM_VM_COUNT
LabPremiumVmCount
LAB_VM_SIZE
LabVmSize
GALLERY_IMAGE
GalleryImage
USER_OWNED_LAB_VM_COUNT_IN_SUBNET
UserOwnedLabVmCountInSubnet
LAB_TARGET_COST
LabTargetCost
ENVIRONMENT_TEMPLATE
EnvironmentTemplate
SCHEDULE_EDIT_PERMISSION
ScheduleEditPermission
"UserOwnedLabVmCount"
UserOwnedLabVmCount
"UserOwnedLabPremiumVmCount"
UserOwnedLabPremiumVmCount
"LabVmCount"
LabVmCount
"LabPremiumVmCount"
LabPremiumVmCount
"LabVmSize"
LabVmSize
"GalleryImage"
GalleryImage
"UserOwnedLabVmCountInSubnet"
UserOwnedLabVmCountInSubnet
"LabTargetCost"
LabTargetCost
"EnvironmentTemplate"
EnvironmentTemplate
"ScheduleEditPermission"
ScheduleEditPermission

PolicyStatus
, PolicyStatusArgs

Enabled
Enabled
Disabled
Disabled
PolicyStatusEnabled
Enabled
PolicyStatusDisabled
Disabled
Enabled
Enabled
Disabled
Disabled
Enabled
Enabled
Disabled
Disabled
ENABLED
Enabled
DISABLED
Disabled
"Enabled"
Enabled
"Disabled"
Disabled

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:devtestlab:Policy {labName} /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} 
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
azure-native-v2 pulumi/pulumi-azure-native
License
Apache-2.0
These are the docs for Azure Native v2. We recommenend using the latest version, Azure Native v3.
Azure Native v2 v2.90.0 published on Thursday, Mar 27, 2025 by Pulumi