We recommend using Azure Native.
azure.cognitive.AccountRaiPolicy
Explore with Pulumi AI
Manages a Cognitive Services Account RAI Policy.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "example-resources",
location: "East US",
});
const exampleAccount = new azure.cognitive.Account("example", {
name: "example-account",
location: example.location,
resourceGroupName: example.name,
kind: "OpenAI",
skuName: "S0",
});
const exampleAccountRaiPolicy = new azure.cognitive.AccountRaiPolicy("example", {
name: "example-rai-policy",
cognitiveAccountId: exampleAccount.id,
basePolicyName: "Microsoft.Default",
contentFilters: [{
name: "Hate",
filterEnabled: true,
blockEnabled: true,
severityThreshold: "High",
source: "Prompt",
}],
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-resources",
location="East US")
example_account = azure.cognitive.Account("example",
name="example-account",
location=example.location,
resource_group_name=example.name,
kind="OpenAI",
sku_name="S0")
example_account_rai_policy = azure.cognitive.AccountRaiPolicy("example",
name="example-rai-policy",
cognitive_account_id=example_account.id,
base_policy_name="Microsoft.Default",
content_filters=[{
"name": "Hate",
"filter_enabled": True,
"block_enabled": True,
"severity_threshold": "High",
"source": "Prompt",
}])
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cognitive"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-resources"),
Location: pulumi.String("East US"),
})
if err != nil {
return err
}
exampleAccount, err := cognitive.NewAccount(ctx, "example", &cognitive.AccountArgs{
Name: pulumi.String("example-account"),
Location: example.Location,
ResourceGroupName: example.Name,
Kind: pulumi.String("OpenAI"),
SkuName: pulumi.String("S0"),
})
if err != nil {
return err
}
_, err = cognitive.NewAccountRaiPolicy(ctx, "example", &cognitive.AccountRaiPolicyArgs{
Name: pulumi.String("example-rai-policy"),
CognitiveAccountId: exampleAccount.ID(),
BasePolicyName: pulumi.String("Microsoft.Default"),
ContentFilters: cognitive.AccountRaiPolicyContentFilterArray{
&cognitive.AccountRaiPolicyContentFilterArgs{
Name: pulumi.String("Hate"),
FilterEnabled: pulumi.Bool(true),
BlockEnabled: pulumi.Bool(true),
SeverityThreshold: pulumi.String("High"),
Source: pulumi.String("Prompt"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-resources",
Location = "East US",
});
var exampleAccount = new Azure.Cognitive.Account("example", new()
{
Name = "example-account",
Location = example.Location,
ResourceGroupName = example.Name,
Kind = "OpenAI",
SkuName = "S0",
});
var exampleAccountRaiPolicy = new Azure.Cognitive.AccountRaiPolicy("example", new()
{
Name = "example-rai-policy",
CognitiveAccountId = exampleAccount.Id,
BasePolicyName = "Microsoft.Default",
ContentFilters = new[]
{
new Azure.Cognitive.Inputs.AccountRaiPolicyContentFilterArgs
{
Name = "Hate",
FilterEnabled = true,
BlockEnabled = true,
SeverityThreshold = "High",
Source = "Prompt",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.cognitive.Account;
import com.pulumi.azure.cognitive.AccountArgs;
import com.pulumi.azure.cognitive.AccountRaiPolicy;
import com.pulumi.azure.cognitive.AccountRaiPolicyArgs;
import com.pulumi.azure.cognitive.inputs.AccountRaiPolicyContentFilterArgs;
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-resources")
.location("East US")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.name("example-account")
.location(example.location())
.resourceGroupName(example.name())
.kind("OpenAI")
.skuName("S0")
.build());
var exampleAccountRaiPolicy = new AccountRaiPolicy("exampleAccountRaiPolicy", AccountRaiPolicyArgs.builder()
.name("example-rai-policy")
.cognitiveAccountId(exampleAccount.id())
.basePolicyName("Microsoft.Default")
.contentFilters(AccountRaiPolicyContentFilterArgs.builder()
.name("Hate")
.filterEnabled(true)
.blockEnabled(true)
.severityThreshold("High")
.source("Prompt")
.build())
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: East US
exampleAccount:
type: azure:cognitive:Account
name: example
properties:
name: example-account
location: ${example.location}
resourceGroupName: ${example.name}
kind: OpenAI
skuName: S0
exampleAccountRaiPolicy:
type: azure:cognitive:AccountRaiPolicy
name: example
properties:
name: example-rai-policy
cognitiveAccountId: ${exampleAccount.id}
basePolicyName: Microsoft.Default
contentFilters:
- name: Hate
filterEnabled: true
blockEnabled: true
severityThreshold: High
source: Prompt
Create AccountRaiPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AccountRaiPolicy(name: string, args: AccountRaiPolicyArgs, opts?: CustomResourceOptions);
@overload
def AccountRaiPolicy(resource_name: str,
args: AccountRaiPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def AccountRaiPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
base_policy_name: Optional[str] = None,
cognitive_account_id: Optional[str] = None,
content_filters: Optional[Sequence[AccountRaiPolicyContentFilterArgs]] = None,
mode: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None)
func NewAccountRaiPolicy(ctx *Context, name string, args AccountRaiPolicyArgs, opts ...ResourceOption) (*AccountRaiPolicy, error)
public AccountRaiPolicy(string name, AccountRaiPolicyArgs args, CustomResourceOptions? opts = null)
public AccountRaiPolicy(String name, AccountRaiPolicyArgs args)
public AccountRaiPolicy(String name, AccountRaiPolicyArgs args, CustomResourceOptions options)
type: azure:cognitive:AccountRaiPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args AccountRaiPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args AccountRaiPolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AccountRaiPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AccountRaiPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AccountRaiPolicyArgs
- 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 accountRaiPolicyResource = new Azure.Cognitive.AccountRaiPolicy("accountRaiPolicyResource", new()
{
BasePolicyName = "string",
CognitiveAccountId = "string",
ContentFilters = new[]
{
new Azure.Cognitive.Inputs.AccountRaiPolicyContentFilterArgs
{
BlockEnabled = false,
FilterEnabled = false,
Name = "string",
SeverityThreshold = "string",
Source = "string",
},
},
Mode = "string",
Name = "string",
Tags =
{
{ "string", "string" },
},
});
example, err := cognitive.NewAccountRaiPolicy(ctx, "accountRaiPolicyResource", &cognitive.AccountRaiPolicyArgs{
BasePolicyName: pulumi.String("string"),
CognitiveAccountId: pulumi.String("string"),
ContentFilters: cognitive.AccountRaiPolicyContentFilterArray{
&cognitive.AccountRaiPolicyContentFilterArgs{
BlockEnabled: pulumi.Bool(false),
FilterEnabled: pulumi.Bool(false),
Name: pulumi.String("string"),
SeverityThreshold: pulumi.String("string"),
Source: pulumi.String("string"),
},
},
Mode: pulumi.String("string"),
Name: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var accountRaiPolicyResource = new AccountRaiPolicy("accountRaiPolicyResource", AccountRaiPolicyArgs.builder()
.basePolicyName("string")
.cognitiveAccountId("string")
.contentFilters(AccountRaiPolicyContentFilterArgs.builder()
.blockEnabled(false)
.filterEnabled(false)
.name("string")
.severityThreshold("string")
.source("string")
.build())
.mode("string")
.name("string")
.tags(Map.of("string", "string"))
.build());
account_rai_policy_resource = azure.cognitive.AccountRaiPolicy("accountRaiPolicyResource",
base_policy_name="string",
cognitive_account_id="string",
content_filters=[{
"block_enabled": False,
"filter_enabled": False,
"name": "string",
"severity_threshold": "string",
"source": "string",
}],
mode="string",
name="string",
tags={
"string": "string",
})
const accountRaiPolicyResource = new azure.cognitive.AccountRaiPolicy("accountRaiPolicyResource", {
basePolicyName: "string",
cognitiveAccountId: "string",
contentFilters: [{
blockEnabled: false,
filterEnabled: false,
name: "string",
severityThreshold: "string",
source: "string",
}],
mode: "string",
name: "string",
tags: {
string: "string",
},
});
type: azure:cognitive:AccountRaiPolicy
properties:
basePolicyName: string
cognitiveAccountId: string
contentFilters:
- blockEnabled: false
filterEnabled: false
name: string
severityThreshold: string
source: string
mode: string
name: string
tags:
string: string
AccountRaiPolicy 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 AccountRaiPolicy resource accepts the following input properties:
- Base
Policy stringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- Cognitive
Account stringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- Content
Filters List<AccountRai Policy Content Filter> - A
content_filter
block as defined below. - Mode string
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - Name string
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Base
Policy stringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- Cognitive
Account stringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- Content
Filters []AccountRai Policy Content Filter Args - A
content_filter
block as defined below. - Mode string
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - Name string
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- map[string]string
- A mapping of tags to assign to the resource.
- base
Policy StringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- cognitive
Account StringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- content
Filters List<AccountRai Policy Content Filter> - A
content_filter
block as defined below. - mode String
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - name String
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- Map<String,String>
- A mapping of tags to assign to the resource.
- base
Policy stringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- cognitive
Account stringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- content
Filters AccountRai Policy Content Filter[] - A
content_filter
block as defined below. - mode string
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - name string
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- base_
policy_ strname - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- cognitive_
account_ strid - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- content_
filters Sequence[AccountRai Policy Content Filter Args] - A
content_filter
block as defined below. - mode str
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - name str
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- base
Policy StringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- cognitive
Account StringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- content
Filters List<Property Map> - A
content_filter
block as defined below. - mode String
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - name String
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- Map<String>
- A mapping of tags to assign to the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the AccountRaiPolicy resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing AccountRaiPolicy Resource
Get an existing AccountRaiPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: AccountRaiPolicyState, opts?: CustomResourceOptions): AccountRaiPolicy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
base_policy_name: Optional[str] = None,
cognitive_account_id: Optional[str] = None,
content_filters: Optional[Sequence[AccountRaiPolicyContentFilterArgs]] = None,
mode: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None) -> AccountRaiPolicy
func GetAccountRaiPolicy(ctx *Context, name string, id IDInput, state *AccountRaiPolicyState, opts ...ResourceOption) (*AccountRaiPolicy, error)
public static AccountRaiPolicy Get(string name, Input<string> id, AccountRaiPolicyState? state, CustomResourceOptions? opts = null)
public static AccountRaiPolicy get(String name, Output<String> id, AccountRaiPolicyState state, CustomResourceOptions options)
resources: _: type: azure:cognitive:AccountRaiPolicy get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Base
Policy stringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- Cognitive
Account stringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- Content
Filters List<AccountRai Policy Content Filter> - A
content_filter
block as defined below. - Mode string
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - Name string
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Base
Policy stringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- Cognitive
Account stringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- Content
Filters []AccountRai Policy Content Filter Args - A
content_filter
block as defined below. - Mode string
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - Name string
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- map[string]string
- A mapping of tags to assign to the resource.
- base
Policy StringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- cognitive
Account StringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- content
Filters List<AccountRai Policy Content Filter> - A
content_filter
block as defined below. - mode String
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - name String
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- Map<String,String>
- A mapping of tags to assign to the resource.
- base
Policy stringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- cognitive
Account stringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- content
Filters AccountRai Policy Content Filter[] - A
content_filter
block as defined below. - mode string
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - name string
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- base_
policy_ strname - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- cognitive_
account_ strid - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- content_
filters Sequence[AccountRai Policy Content Filter Args] - A
content_filter
block as defined below. - mode str
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - name str
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- base
Policy StringName - The name of the base policy to use for this RAI Policy. Changing this forces a new resource to be created.
- cognitive
Account StringId - The ID of the Cognitive Service Account to which this RAI Policy should be associated. Changing this forces a new resource to be created.
- content
Filters List<Property Map> - A
content_filter
block as defined below. - mode String
- The mode of the RAI Policy. Possible values are
Default
,Deferred
,Blocking
orAsynchronous_filter
. - name String
- The name of the Cognitive Service Account RAI Policy. Changing this forces a new resource to be created.
- Map<String>
- A mapping of tags to assign to the resource.
Supporting Types
AccountRaiPolicyContentFilter, AccountRaiPolicyContentFilterArgs
- Block
Enabled bool - Whether the filter should block content. Possible values are
true
orfalse
. - Filter
Enabled bool - Whether the filter is enabled. Possible values are
true
orfalse
. - Name string
- The name of the content filter.
- Severity
Threshold string - The severity threshold for the filter. Possible values are
Low
,Medium
orHigh
. - Source string
- Content source to apply the content filter. Possible values are
Prompt
orCompletion
.
- Block
Enabled bool - Whether the filter should block content. Possible values are
true
orfalse
. - Filter
Enabled bool - Whether the filter is enabled. Possible values are
true
orfalse
. - Name string
- The name of the content filter.
- Severity
Threshold string - The severity threshold for the filter. Possible values are
Low
,Medium
orHigh
. - Source string
- Content source to apply the content filter. Possible values are
Prompt
orCompletion
.
- block
Enabled Boolean - Whether the filter should block content. Possible values are
true
orfalse
. - filter
Enabled Boolean - Whether the filter is enabled. Possible values are
true
orfalse
. - name String
- The name of the content filter.
- severity
Threshold String - The severity threshold for the filter. Possible values are
Low
,Medium
orHigh
. - source String
- Content source to apply the content filter. Possible values are
Prompt
orCompletion
.
- block
Enabled boolean - Whether the filter should block content. Possible values are
true
orfalse
. - filter
Enabled boolean - Whether the filter is enabled. Possible values are
true
orfalse
. - name string
- The name of the content filter.
- severity
Threshold string - The severity threshold for the filter. Possible values are
Low
,Medium
orHigh
. - source string
- Content source to apply the content filter. Possible values are
Prompt
orCompletion
.
- block_
enabled bool - Whether the filter should block content. Possible values are
true
orfalse
. - filter_
enabled bool - Whether the filter is enabled. Possible values are
true
orfalse
. - name str
- The name of the content filter.
- severity_
threshold str - The severity threshold for the filter. Possible values are
Low
,Medium
orHigh
. - source str
- Content source to apply the content filter. Possible values are
Prompt
orCompletion
.
- block
Enabled Boolean - Whether the filter should block content. Possible values are
true
orfalse
. - filter
Enabled Boolean - Whether the filter is enabled. Possible values are
true
orfalse
. - name String
- The name of the content filter.
- severity
Threshold String - The severity threshold for the filter. Possible values are
Low
,Medium
orHigh
. - source String
- Content source to apply the content filter. Possible values are
Prompt
orCompletion
.
Import
Cognitive Service Account RAI Policies can be imported using the resource id
, e.g.
$ pulumi import azure:cognitive/accountRaiPolicy:AccountRaiPolicy policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.CognitiveServices/accounts/account1/raiPolicies/policy1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.