1. Packages
  2. Azure Native v2
  3. API Docs
  4. cache
  5. AccessPolicy
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.cache.AccessPolicy

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

Response to get/put access policy. Azure REST API version: 2023-05-01-preview.

Other available API versions: 2023-08-01, 2024-03-01, 2024-04-01-preview, 2024-11-01.

Example Usage

RedisCacheAccessPolicyCreateUpdate

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

return await Deployment.RunAsync(() => 
{
    var accessPolicy = new AzureNative.Cache.AccessPolicy("accessPolicy", new()
    {
        AccessPolicyName = "accessPolicy1",
        CacheName = "cache1",
        Permissions = "+get +hget",
        ResourceGroupName = "rg1",
    });

});
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cache.NewAccessPolicy(ctx, "accessPolicy", &cache.AccessPolicyArgs{
			AccessPolicyName:  pulumi.String("accessPolicy1"),
			CacheName:         pulumi.String("cache1"),
			Permissions:       pulumi.String("+get +hget"),
			ResourceGroupName: pulumi.String("rg1"),
		})
		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.cache.AccessPolicy;
import com.pulumi.azurenative.cache.AccessPolicyArgs;
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 accessPolicy = new AccessPolicy("accessPolicy", AccessPolicyArgs.builder()
            .accessPolicyName("accessPolicy1")
            .cacheName("cache1")
            .permissions("+get +hget")
            .resourceGroupName("rg1")
            .build());

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

const accessPolicy = new azure_native.cache.AccessPolicy("accessPolicy", {
    accessPolicyName: "accessPolicy1",
    cacheName: "cache1",
    permissions: "+get +hget",
    resourceGroupName: "rg1",
});
Copy
import pulumi
import pulumi_azure_native as azure_native

access_policy = azure_native.cache.AccessPolicy("accessPolicy",
    access_policy_name="accessPolicy1",
    cache_name="cache1",
    permissions="+get +hget",
    resource_group_name="rg1")
Copy
resources:
  accessPolicy:
    type: azure-native:cache:AccessPolicy
    properties:
      accessPolicyName: accessPolicy1
      cacheName: cache1
      permissions: +get +hget
      resourceGroupName: rg1
Copy

Create AccessPolicy Resource

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

Constructor syntax

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

@overload
def AccessPolicy(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 cache_name: Optional[str] = None,
                 permissions: Optional[str] = None,
                 resource_group_name: Optional[str] = None,
                 access_policy_name: Optional[str] = None)
func NewAccessPolicy(ctx *Context, name string, args AccessPolicyArgs, opts ...ResourceOption) (*AccessPolicy, error)
public AccessPolicy(string name, AccessPolicyArgs args, CustomResourceOptions? opts = null)
public AccessPolicy(String name, AccessPolicyArgs args)
public AccessPolicy(String name, AccessPolicyArgs args, CustomResourceOptions options)
type: azure-native:cache:AccessPolicy
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. AccessPolicyArgs
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. AccessPolicyArgs
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. AccessPolicyArgs
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. AccessPolicyArgs
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. AccessPolicyArgs
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 accessPolicyResource = new AzureNative.Cache.AccessPolicy("accessPolicyResource", new()
{
    CacheName = "string",
    Permissions = "string",
    ResourceGroupName = "string",
    AccessPolicyName = "string",
});
Copy
example, err := cache.NewAccessPolicy(ctx, "accessPolicyResource", &cache.AccessPolicyArgs{
	CacheName:         "string",
	Permissions:       "string",
	ResourceGroupName: "string",
	AccessPolicyName:  "string",
})
Copy
var accessPolicyResource = new AccessPolicy("accessPolicyResource", AccessPolicyArgs.builder()
    .cacheName("string")
    .permissions("string")
    .resourceGroupName("string")
    .accessPolicyName("string")
    .build());
Copy
access_policy_resource = azure_native.cache.AccessPolicy("accessPolicyResource",
    cache_name=string,
    permissions=string,
    resource_group_name=string,
    access_policy_name=string)
Copy
const accessPolicyResource = new azure_native.cache.AccessPolicy("accessPolicyResource", {
    cacheName: "string",
    permissions: "string",
    resourceGroupName: "string",
    accessPolicyName: "string",
});
Copy
type: azure-native:cache:AccessPolicy
properties:
    accessPolicyName: string
    cacheName: string
    permissions: string
    resourceGroupName: string
Copy

AccessPolicy 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 AccessPolicy resource accepts the following input properties:

CacheName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Redis cache.
Permissions This property is required. string
Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group. The name is case insensitive.
AccessPolicyName Changes to this property will trigger replacement. string
The name of the access policy that is being added to the Redis cache.
CacheName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Redis cache.
Permissions This property is required. string
Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group. The name is case insensitive.
AccessPolicyName Changes to this property will trigger replacement. string
The name of the access policy that is being added to the Redis cache.
cacheName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Redis cache.
permissions This property is required. String
Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group. The name is case insensitive.
accessPolicyName Changes to this property will trigger replacement. String
The name of the access policy that is being added to the Redis cache.
cacheName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Redis cache.
permissions This property is required. string
Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group. The name is case insensitive.
accessPolicyName Changes to this property will trigger replacement. string
The name of the access policy that is being added to the Redis cache.
cache_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Redis cache.
permissions This property is required. str
Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group. The name is case insensitive.
access_policy_name Changes to this property will trigger replacement. str
The name of the access policy that is being added to the Redis cache.
cacheName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Redis cache.
permissions This property is required. String
Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group. The name is case insensitive.
accessPolicyName Changes to this property will trigger replacement. String
The name of the access policy that is being added to the Redis cache.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the resource
ProvisioningState string
Provisioning state of access policy
Type string
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the resource
ProvisioningState string
Provisioning state of access policy
Type string
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the resource
provisioningState String
Provisioning state of access policy
type String
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
id string
The provider-assigned unique ID for this managed resource.
name string
The name of the resource
provisioningState string
Provisioning state of access policy
type string
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
id str
The provider-assigned unique ID for this managed resource.
name str
The name of the resource
provisioning_state str
Provisioning state of access policy
type str
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the resource
provisioningState String
Provisioning state of access policy
type String
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

Import

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

$ pulumi import azure-native:cache:AccessPolicy accessPolicy1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} 
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