1. Packages
  2. Azure Classic
  3. API Docs
  4. redis
  5. CacheAccessPolicyAssignment

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

azure.redis.CacheAccessPolicyAssignment

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

    Manages a Redis Cache Access Policy Assignment

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const test = azure.core.getClientConfig({});
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "East US",
    });
    const exampleCache = new azure.redis.Cache("example", {
        name: "example",
        location: example.location,
        resourceGroupName: example.name,
        capacity: 1,
        family: "P",
        skuName: "Premium",
        enableNonSslPort: false,
        redisConfiguration: {
            maxmemoryReserved: 2,
            maxmemoryDelta: 2,
            maxmemoryPolicy: "allkeys-lru",
        },
    });
    const exampleCacheAccessPolicyAssignment = new azure.redis.CacheAccessPolicyAssignment("example", {
        name: "example",
        redisCacheId: exampleCache.id,
        accessPolicyName: "Data Contributor",
        objectId: test.then(test => test.objectId),
        objectIdAlias: "ServicePrincipal",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    test = azure.core.get_client_config()
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="East US")
    example_cache = azure.redis.Cache("example",
        name="example",
        location=example.location,
        resource_group_name=example.name,
        capacity=1,
        family="P",
        sku_name="Premium",
        enable_non_ssl_port=False,
        redis_configuration=azure.redis.CacheRedisConfigurationArgs(
            maxmemory_reserved=2,
            maxmemory_delta=2,
            maxmemory_policy="allkeys-lru",
        ))
    example_cache_access_policy_assignment = azure.redis.CacheAccessPolicyAssignment("example",
        name="example",
        redis_cache_id=example_cache.id,
        access_policy_name="Data Contributor",
        object_id=test.object_id,
        object_id_alias="ServicePrincipal")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/redis"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := core.GetClientConfig(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("East US"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleCache, err := redis.NewCache(ctx, "example", &redis.CacheArgs{
    			Name:              pulumi.String("example"),
    			Location:          example.Location,
    			ResourceGroupName: example.Name,
    			Capacity:          pulumi.Int(1),
    			Family:            pulumi.String("P"),
    			SkuName:           pulumi.String("Premium"),
    			EnableNonSslPort:  pulumi.Bool(false),
    			RedisConfiguration: &redis.CacheRedisConfigurationArgs{
    				MaxmemoryReserved: pulumi.Int(2),
    				MaxmemoryDelta:    pulumi.Int(2),
    				MaxmemoryPolicy:   pulumi.String("allkeys-lru"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = redis.NewCacheAccessPolicyAssignment(ctx, "example", &redis.CacheAccessPolicyAssignmentArgs{
    			Name:             pulumi.String("example"),
    			RedisCacheId:     exampleCache.ID(),
    			AccessPolicyName: pulumi.String("Data Contributor"),
    			ObjectId:         pulumi.String(test.ObjectId),
    			ObjectIdAlias:    pulumi.String("ServicePrincipal"),
    		})
    		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 test = Azure.Core.GetClientConfig.Invoke();
    
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "East US",
        });
    
        var exampleCache = new Azure.Redis.Cache("example", new()
        {
            Name = "example",
            Location = example.Location,
            ResourceGroupName = example.Name,
            Capacity = 1,
            Family = "P",
            SkuName = "Premium",
            EnableNonSslPort = false,
            RedisConfiguration = new Azure.Redis.Inputs.CacheRedisConfigurationArgs
            {
                MaxmemoryReserved = 2,
                MaxmemoryDelta = 2,
                MaxmemoryPolicy = "allkeys-lru",
            },
        });
    
        var exampleCacheAccessPolicyAssignment = new Azure.Redis.CacheAccessPolicyAssignment("example", new()
        {
            Name = "example",
            RedisCacheId = exampleCache.Id,
            AccessPolicyName = "Data Contributor",
            ObjectId = test.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
            ObjectIdAlias = "ServicePrincipal",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.CoreFunctions;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.redis.Cache;
    import com.pulumi.azure.redis.CacheArgs;
    import com.pulumi.azure.redis.inputs.CacheRedisConfigurationArgs;
    import com.pulumi.azure.redis.CacheAccessPolicyAssignment;
    import com.pulumi.azure.redis.CacheAccessPolicyAssignmentArgs;
    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) {
            final var test = CoreFunctions.getClientConfig();
    
            var example = new ResourceGroup("example", ResourceGroupArgs.builder()
                .name("example-resources")
                .location("East US")
                .build());
    
            var exampleCache = new Cache("exampleCache", CacheArgs.builder()
                .name("example")
                .location(example.location())
                .resourceGroupName(example.name())
                .capacity(1)
                .family("P")
                .skuName("Premium")
                .enableNonSslPort(false)
                .redisConfiguration(CacheRedisConfigurationArgs.builder()
                    .maxmemoryReserved(2)
                    .maxmemoryDelta(2)
                    .maxmemoryPolicy("allkeys-lru")
                    .build())
                .build());
    
            var exampleCacheAccessPolicyAssignment = new CacheAccessPolicyAssignment("exampleCacheAccessPolicyAssignment", CacheAccessPolicyAssignmentArgs.builder()
                .name("example")
                .redisCacheId(exampleCache.id())
                .accessPolicyName("Data Contributor")
                .objectId(test.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
                .objectIdAlias("ServicePrincipal")
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: East US
      exampleCache:
        type: azure:redis:Cache
        name: example
        properties:
          name: example
          location: ${example.location}
          resourceGroupName: ${example.name}
          capacity: 1
          family: P
          skuName: Premium
          enableNonSslPort: false
          redisConfiguration:
            maxmemoryReserved: 2
            maxmemoryDelta: 2
            maxmemoryPolicy: allkeys-lru
      exampleCacheAccessPolicyAssignment:
        type: azure:redis:CacheAccessPolicyAssignment
        name: example
        properties:
          name: example
          redisCacheId: ${exampleCache.id}
          accessPolicyName: Data Contributor
          objectId: ${test.objectId}
          objectIdAlias: ServicePrincipal
    variables:
      test:
        fn::invoke:
          Function: azure:core:getClientConfig
          Arguments: {}
    

    Create CacheAccessPolicyAssignment Resource

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

    Constructor syntax

    new CacheAccessPolicyAssignment(name: string, args: CacheAccessPolicyAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def CacheAccessPolicyAssignment(resource_name: str,
                                    args: CacheAccessPolicyAssignmentArgs,
                                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def CacheAccessPolicyAssignment(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    access_policy_name: Optional[str] = None,
                                    object_id: Optional[str] = None,
                                    object_id_alias: Optional[str] = None,
                                    redis_cache_id: Optional[str] = None,
                                    name: Optional[str] = None)
    func NewCacheAccessPolicyAssignment(ctx *Context, name string, args CacheAccessPolicyAssignmentArgs, opts ...ResourceOption) (*CacheAccessPolicyAssignment, error)
    public CacheAccessPolicyAssignment(string name, CacheAccessPolicyAssignmentArgs args, CustomResourceOptions? opts = null)
    public CacheAccessPolicyAssignment(String name, CacheAccessPolicyAssignmentArgs args)
    public CacheAccessPolicyAssignment(String name, CacheAccessPolicyAssignmentArgs args, CustomResourceOptions options)
    
    type: azure:redis:CacheAccessPolicyAssignment
    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 CacheAccessPolicyAssignmentArgs
    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 CacheAccessPolicyAssignmentArgs
    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 CacheAccessPolicyAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CacheAccessPolicyAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CacheAccessPolicyAssignmentArgs
    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 cacheAccessPolicyAssignmentResource = new Azure.Redis.CacheAccessPolicyAssignment("cacheAccessPolicyAssignmentResource", new()
    {
        AccessPolicyName = "string",
        ObjectId = "string",
        ObjectIdAlias = "string",
        RedisCacheId = "string",
        Name = "string",
    });
    
    example, err := redis.NewCacheAccessPolicyAssignment(ctx, "cacheAccessPolicyAssignmentResource", &redis.CacheAccessPolicyAssignmentArgs{
    	AccessPolicyName: pulumi.String("string"),
    	ObjectId:         pulumi.String("string"),
    	ObjectIdAlias:    pulumi.String("string"),
    	RedisCacheId:     pulumi.String("string"),
    	Name:             pulumi.String("string"),
    })
    
    var cacheAccessPolicyAssignmentResource = new CacheAccessPolicyAssignment("cacheAccessPolicyAssignmentResource", CacheAccessPolicyAssignmentArgs.builder()
        .accessPolicyName("string")
        .objectId("string")
        .objectIdAlias("string")
        .redisCacheId("string")
        .name("string")
        .build());
    
    cache_access_policy_assignment_resource = azure.redis.CacheAccessPolicyAssignment("cacheAccessPolicyAssignmentResource",
        access_policy_name="string",
        object_id="string",
        object_id_alias="string",
        redis_cache_id="string",
        name="string")
    
    const cacheAccessPolicyAssignmentResource = new azure.redis.CacheAccessPolicyAssignment("cacheAccessPolicyAssignmentResource", {
        accessPolicyName: "string",
        objectId: "string",
        objectIdAlias: "string",
        redisCacheId: "string",
        name: "string",
    });
    
    type: azure:redis:CacheAccessPolicyAssignment
    properties:
        accessPolicyName: string
        name: string
        objectId: string
        objectIdAlias: string
        redisCacheId: string
    

    CacheAccessPolicyAssignment Resource Properties

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

    Inputs

    The CacheAccessPolicyAssignment resource accepts the following input properties:

    AccessPolicyName string
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    ObjectId string
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    ObjectIdAlias string
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    RedisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    Name string
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    AccessPolicyName string
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    ObjectId string
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    ObjectIdAlias string
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    RedisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    Name string
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    accessPolicyName String
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectId String
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectIdAlias String
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    redisCacheId String
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    name String
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    accessPolicyName string
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectId string
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectIdAlias string
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    redisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    name string
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    access_policy_name str
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    object_id str
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    object_id_alias str
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    redis_cache_id str
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    name str
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    accessPolicyName String
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectId String
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectIdAlias String
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    redisCacheId String
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    name String
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the CacheAccessPolicyAssignment 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 CacheAccessPolicyAssignment Resource

    Get an existing CacheAccessPolicyAssignment 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?: CacheAccessPolicyAssignmentState, opts?: CustomResourceOptions): CacheAccessPolicyAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            access_policy_name: Optional[str] = None,
            name: Optional[str] = None,
            object_id: Optional[str] = None,
            object_id_alias: Optional[str] = None,
            redis_cache_id: Optional[str] = None) -> CacheAccessPolicyAssignment
    func GetCacheAccessPolicyAssignment(ctx *Context, name string, id IDInput, state *CacheAccessPolicyAssignmentState, opts ...ResourceOption) (*CacheAccessPolicyAssignment, error)
    public static CacheAccessPolicyAssignment Get(string name, Input<string> id, CacheAccessPolicyAssignmentState? state, CustomResourceOptions? opts = null)
    public static CacheAccessPolicyAssignment get(String name, Output<String> id, CacheAccessPolicyAssignmentState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    AccessPolicyName string
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    Name string
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    ObjectId string
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    ObjectIdAlias string
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    RedisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    AccessPolicyName string
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    Name string
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    ObjectId string
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    ObjectIdAlias string
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    RedisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    accessPolicyName String
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    name String
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectId String
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectIdAlias String
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    redisCacheId String
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    accessPolicyName string
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    name string
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectId string
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectIdAlias string
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    redisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    access_policy_name str
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    name str
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    object_id str
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    object_id_alias str
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    redis_cache_id str
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    accessPolicyName String
    The name of the Access Policy to be assigned. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    name String
    The name of the Redis Cache Access Policy Assignment. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectId String
    The principal ID to be assigned the Access Policy. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    objectIdAlias String
    The alias of the principal ID. User-friendly name for object ID. Also represents username for token based authentication. Changing this forces a new Redis Cache Access Policy Assignment to be created.
    redisCacheId String
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy Assignment to be created.

    Import

    Redis Cache Policy Assignment can be imported using the resource id, e.g.

    $ pulumi import azure:redis/cacheAccessPolicyAssignment:CacheAccessPolicyAssignment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1/accessPolicyAssignments/assignment1
    

    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.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi