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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.redis.getCache

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

Use this data source to access information about an existing Redis Cache

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.redis.getCache({
    name: "myrediscache",
    resourceGroupName: "redis-cache",
});
export const primaryAccessKey = example.then(example => example.primaryAccessKey);
export const hostname = example.then(example => example.hostname);
Copy
import pulumi
import pulumi_azure as azure

example = azure.redis.get_cache(name="myrediscache",
    resource_group_name="redis-cache")
pulumi.export("primaryAccessKey", example.primary_access_key)
pulumi.export("hostname", example.hostname)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/redis"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := redis.LookupCache(ctx, &redis.LookupCacheArgs{
			Name:              "myrediscache",
			ResourceGroupName: "redis-cache",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("primaryAccessKey", example.PrimaryAccessKey)
		ctx.Export("hostname", example.Hostname)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Redis.GetCache.Invoke(new()
    {
        Name = "myrediscache",
        ResourceGroupName = "redis-cache",
    });

    return new Dictionary<string, object?>
    {
        ["primaryAccessKey"] = example.Apply(getCacheResult => getCacheResult.PrimaryAccessKey),
        ["hostname"] = example.Apply(getCacheResult => getCacheResult.Hostname),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.redis.RedisFunctions;
import com.pulumi.azure.redis.inputs.GetCacheArgs;
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 example = RedisFunctions.getCache(GetCacheArgs.builder()
            .name("myrediscache")
            .resourceGroupName("redis-cache")
            .build());

        ctx.export("primaryAccessKey", example.applyValue(getCacheResult -> getCacheResult.primaryAccessKey()));
        ctx.export("hostname", example.applyValue(getCacheResult -> getCacheResult.hostname()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:redis:getCache
      arguments:
        name: myrediscache
        resourceGroupName: redis-cache
outputs:
  primaryAccessKey: ${example.primaryAccessKey}
  hostname: ${example.hostname}
Copy

Using getCache

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getCache(args: GetCacheArgs, opts?: InvokeOptions): Promise<GetCacheResult>
function getCacheOutput(args: GetCacheOutputArgs, opts?: InvokeOptions): Output<GetCacheResult>
Copy
def get_cache(name: Optional[str] = None,
              resource_group_name: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetCacheResult
def get_cache_output(name: Optional[pulumi.Input[str]] = None,
              resource_group_name: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetCacheResult]
Copy
func LookupCache(ctx *Context, args *LookupCacheArgs, opts ...InvokeOption) (*LookupCacheResult, error)
func LookupCacheOutput(ctx *Context, args *LookupCacheOutputArgs, opts ...InvokeOption) LookupCacheResultOutput
Copy

> Note: This function is named LookupCache in the Go SDK.

public static class GetCache 
{
    public static Task<GetCacheResult> InvokeAsync(GetCacheArgs args, InvokeOptions? opts = null)
    public static Output<GetCacheResult> Invoke(GetCacheInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetCacheResult> getCache(GetCacheArgs args, InvokeOptions options)
public static Output<GetCacheResult> getCache(GetCacheArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:redis/getCache:getCache
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the Redis cache
ResourceGroupName This property is required. string
The name of the resource group the Redis cache instance is located in.
Name This property is required. string
The name of the Redis cache
ResourceGroupName This property is required. string
The name of the resource group the Redis cache instance is located in.
name This property is required. String
The name of the Redis cache
resourceGroupName This property is required. String
The name of the resource group the Redis cache instance is located in.
name This property is required. string
The name of the Redis cache
resourceGroupName This property is required. string
The name of the resource group the Redis cache instance is located in.
name This property is required. str
The name of the Redis cache
resource_group_name This property is required. str
The name of the resource group the Redis cache instance is located in.
name This property is required. String
The name of the Redis cache
resourceGroupName This property is required. String
The name of the resource group the Redis cache instance is located in.

getCache Result

The following output properties are available:

AccessKeysAuthenticationEnabled bool
Specifies if access key authentication is enabled.
Capacity int
The size of the Redis Cache deployed.
Family string
The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)
Hostname string
The Hostname of the Redis Instance
Id string
The provider-assigned unique ID for this managed resource.
Location string
The location of the Redis Cache.
MinimumTlsVersion string
The minimum TLS version.
Name string
NonSslPortEnabled bool
PatchSchedules List<GetCachePatchSchedule>
A list of patch_schedule blocks as defined below.
Port int
The non-SSL Port of the Redis Instance
PrimaryAccessKey string
The Primary Access Key for the Redis Instance
PrimaryConnectionString string
The primary connection string of the Redis Instance.
PrivateStaticIpAddress string
The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
RedisConfigurations List<GetCacheRedisConfiguration>
A redis_configuration block as defined below.
ResourceGroupName string
SecondaryAccessKey string
The Secondary Access Key for the Redis Instance
SecondaryConnectionString string
The secondary connection string of the Redis Instance.
ShardCount int
SkuName string
The SKU of Redis used. Possible values are Basic, Standard and Premium.
SslPort int
The SSL Port of the Redis Instance
SubnetId string
Tags Dictionary<string, string>
Zones List<string>
A list of Availability Zones in which this Redis Cache is located.
AccessKeysAuthenticationEnabled bool
Specifies if access key authentication is enabled.
Capacity int
The size of the Redis Cache deployed.
Family string
The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)
Hostname string
The Hostname of the Redis Instance
Id string
The provider-assigned unique ID for this managed resource.
Location string
The location of the Redis Cache.
MinimumTlsVersion string
The minimum TLS version.
Name string
NonSslPortEnabled bool
PatchSchedules []GetCachePatchSchedule
A list of patch_schedule blocks as defined below.
Port int
The non-SSL Port of the Redis Instance
PrimaryAccessKey string
The Primary Access Key for the Redis Instance
PrimaryConnectionString string
The primary connection string of the Redis Instance.
PrivateStaticIpAddress string
The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
RedisConfigurations []GetCacheRedisConfiguration
A redis_configuration block as defined below.
ResourceGroupName string
SecondaryAccessKey string
The Secondary Access Key for the Redis Instance
SecondaryConnectionString string
The secondary connection string of the Redis Instance.
ShardCount int
SkuName string
The SKU of Redis used. Possible values are Basic, Standard and Premium.
SslPort int
The SSL Port of the Redis Instance
SubnetId string
Tags map[string]string
Zones []string
A list of Availability Zones in which this Redis Cache is located.
accessKeysAuthenticationEnabled Boolean
Specifies if access key authentication is enabled.
capacity Integer
The size of the Redis Cache deployed.
family String
The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)
hostname String
The Hostname of the Redis Instance
id String
The provider-assigned unique ID for this managed resource.
location String
The location of the Redis Cache.
minimumTlsVersion String
The minimum TLS version.
name String
nonSslPortEnabled Boolean
patchSchedules List<GetCachePatchSchedule>
A list of patch_schedule blocks as defined below.
port Integer
The non-SSL Port of the Redis Instance
primaryAccessKey String
The Primary Access Key for the Redis Instance
primaryConnectionString String
The primary connection string of the Redis Instance.
privateStaticIpAddress String
The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
redisConfigurations List<GetCacheRedisConfiguration>
A redis_configuration block as defined below.
resourceGroupName String
secondaryAccessKey String
The Secondary Access Key for the Redis Instance
secondaryConnectionString String
The secondary connection string of the Redis Instance.
shardCount Integer
skuName String
The SKU of Redis used. Possible values are Basic, Standard and Premium.
sslPort Integer
The SSL Port of the Redis Instance
subnetId String
tags Map<String,String>
zones List<String>
A list of Availability Zones in which this Redis Cache is located.
accessKeysAuthenticationEnabled boolean
Specifies if access key authentication is enabled.
capacity number
The size of the Redis Cache deployed.
family string
The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)
hostname string
The Hostname of the Redis Instance
id string
The provider-assigned unique ID for this managed resource.
location string
The location of the Redis Cache.
minimumTlsVersion string
The minimum TLS version.
name string
nonSslPortEnabled boolean
patchSchedules GetCachePatchSchedule[]
A list of patch_schedule blocks as defined below.
port number
The non-SSL Port of the Redis Instance
primaryAccessKey string
The Primary Access Key for the Redis Instance
primaryConnectionString string
The primary connection string of the Redis Instance.
privateStaticIpAddress string
The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
redisConfigurations GetCacheRedisConfiguration[]
A redis_configuration block as defined below.
resourceGroupName string
secondaryAccessKey string
The Secondary Access Key for the Redis Instance
secondaryConnectionString string
The secondary connection string of the Redis Instance.
shardCount number
skuName string
The SKU of Redis used. Possible values are Basic, Standard and Premium.
sslPort number
The SSL Port of the Redis Instance
subnetId string
tags {[key: string]: string}
zones string[]
A list of Availability Zones in which this Redis Cache is located.
access_keys_authentication_enabled bool
Specifies if access key authentication is enabled.
capacity int
The size of the Redis Cache deployed.
family str
The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)
hostname str
The Hostname of the Redis Instance
id str
The provider-assigned unique ID for this managed resource.
location str
The location of the Redis Cache.
minimum_tls_version str
The minimum TLS version.
name str
non_ssl_port_enabled bool
patch_schedules Sequence[GetCachePatchSchedule]
A list of patch_schedule blocks as defined below.
port int
The non-SSL Port of the Redis Instance
primary_access_key str
The Primary Access Key for the Redis Instance
primary_connection_string str
The primary connection string of the Redis Instance.
private_static_ip_address str
The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
redis_configurations Sequence[GetCacheRedisConfiguration]
A redis_configuration block as defined below.
resource_group_name str
secondary_access_key str
The Secondary Access Key for the Redis Instance
secondary_connection_string str
The secondary connection string of the Redis Instance.
shard_count int
sku_name str
The SKU of Redis used. Possible values are Basic, Standard and Premium.
ssl_port int
The SSL Port of the Redis Instance
subnet_id str
tags Mapping[str, str]
zones Sequence[str]
A list of Availability Zones in which this Redis Cache is located.
accessKeysAuthenticationEnabled Boolean
Specifies if access key authentication is enabled.
capacity Number
The size of the Redis Cache deployed.
family String
The SKU family/pricing group used. Possible values are C (for Basic/Standard SKU family) and P (for Premium)
hostname String
The Hostname of the Redis Instance
id String
The provider-assigned unique ID for this managed resource.
location String
The location of the Redis Cache.
minimumTlsVersion String
The minimum TLS version.
name String
nonSslPortEnabled Boolean
patchSchedules List<Property Map>
A list of patch_schedule blocks as defined below.
port Number
The non-SSL Port of the Redis Instance
primaryAccessKey String
The Primary Access Key for the Redis Instance
primaryConnectionString String
The primary connection string of the Redis Instance.
privateStaticIpAddress String
The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
redisConfigurations List<Property Map>
A redis_configuration block as defined below.
resourceGroupName String
secondaryAccessKey String
The Secondary Access Key for the Redis Instance
secondaryConnectionString String
The secondary connection string of the Redis Instance.
shardCount Number
skuName String
The SKU of Redis used. Possible values are Basic, Standard and Premium.
sslPort Number
The SSL Port of the Redis Instance
subnetId String
tags Map<String>
zones List<String>
A list of Availability Zones in which this Redis Cache is located.

Supporting Types

GetCachePatchSchedule

DayOfWeek This property is required. string
the Weekday name for the patch item
MaintenanceWindow This property is required. string
The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
StartHourUtc This property is required. int
The Start Hour for maintenance in UTC
DayOfWeek This property is required. string
the Weekday name for the patch item
MaintenanceWindow This property is required. string
The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
StartHourUtc This property is required. int
The Start Hour for maintenance in UTC
dayOfWeek This property is required. String
the Weekday name for the patch item
maintenanceWindow This property is required. String
The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
startHourUtc This property is required. Integer
The Start Hour for maintenance in UTC
dayOfWeek This property is required. string
the Weekday name for the patch item
maintenanceWindow This property is required. string
The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
startHourUtc This property is required. number
The Start Hour for maintenance in UTC
day_of_week This property is required. str
the Weekday name for the patch item
maintenance_window This property is required. str
The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
start_hour_utc This property is required. int
The Start Hour for maintenance in UTC
dayOfWeek This property is required. String
the Weekday name for the patch item
maintenanceWindow This property is required. String
The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
startHourUtc This property is required. Number
The Start Hour for maintenance in UTC

GetCacheRedisConfiguration

ActiveDirectoryAuthenticationEnabled This property is required. bool
Specifies if Microsoft Entra (AAD) authentication is enabled.
AofBackupEnabled This property is required. bool
AofStorageConnectionString0 This property is required. string
AofStorageConnectionString1 This property is required. string
AuthenticationEnabled This property is required. bool
DataPersistenceAuthenticationMethod This property is required. string
Maxclients This property is required. int
MaxfragmentationmemoryReserved This property is required. int
Value in megabytes reserved to accommodate for memory fragmentation.
MaxmemoryDelta This property is required. int
The max-memory delta for this Redis instance.
MaxmemoryPolicy This property is required. string
How Redis will select what to remove when maxmemory is reached.
MaxmemoryReserved This property is required. int
The value in megabytes reserved for non-cache usage e.g. failover
NotifyKeyspaceEvents This property is required. string
RdbBackupEnabled This property is required. bool
Is Backup Enabled? Only supported on Premium SKUs.
RdbBackupFrequency This property is required. int
The Backup Frequency in Minutes. Only supported on Premium SKUs.
RdbBackupMaxSnapshotCount This property is required. int
The maximum number of snapshots that can be created as a backup.
RdbStorageConnectionString This property is required. string
The Connection String to the Storage Account. Only supported for Premium SKUs.
StorageAccountSubscriptionId This property is required. string
The ID of the Subscription containing the Storage Account.
ActiveDirectoryAuthenticationEnabled This property is required. bool
Specifies if Microsoft Entra (AAD) authentication is enabled.
AofBackupEnabled This property is required. bool
AofStorageConnectionString0 This property is required. string
AofStorageConnectionString1 This property is required. string
AuthenticationEnabled This property is required. bool
DataPersistenceAuthenticationMethod This property is required. string
Maxclients This property is required. int
MaxfragmentationmemoryReserved This property is required. int
Value in megabytes reserved to accommodate for memory fragmentation.
MaxmemoryDelta This property is required. int
The max-memory delta for this Redis instance.
MaxmemoryPolicy This property is required. string
How Redis will select what to remove when maxmemory is reached.
MaxmemoryReserved This property is required. int
The value in megabytes reserved for non-cache usage e.g. failover
NotifyKeyspaceEvents This property is required. string
RdbBackupEnabled This property is required. bool
Is Backup Enabled? Only supported on Premium SKUs.
RdbBackupFrequency This property is required. int
The Backup Frequency in Minutes. Only supported on Premium SKUs.
RdbBackupMaxSnapshotCount This property is required. int
The maximum number of snapshots that can be created as a backup.
RdbStorageConnectionString This property is required. string
The Connection String to the Storage Account. Only supported for Premium SKUs.
StorageAccountSubscriptionId This property is required. string
The ID of the Subscription containing the Storage Account.
activeDirectoryAuthenticationEnabled This property is required. Boolean
Specifies if Microsoft Entra (AAD) authentication is enabled.
aofBackupEnabled This property is required. Boolean
aofStorageConnectionString0 This property is required. String
aofStorageConnectionString1 This property is required. String
authenticationEnabled This property is required. Boolean
dataPersistenceAuthenticationMethod This property is required. String
maxclients This property is required. Integer
maxfragmentationmemoryReserved This property is required. Integer
Value in megabytes reserved to accommodate for memory fragmentation.
maxmemoryDelta This property is required. Integer
The max-memory delta for this Redis instance.
maxmemoryPolicy This property is required. String
How Redis will select what to remove when maxmemory is reached.
maxmemoryReserved This property is required. Integer
The value in megabytes reserved for non-cache usage e.g. failover
notifyKeyspaceEvents This property is required. String
rdbBackupEnabled This property is required. Boolean
Is Backup Enabled? Only supported on Premium SKUs.
rdbBackupFrequency This property is required. Integer
The Backup Frequency in Minutes. Only supported on Premium SKUs.
rdbBackupMaxSnapshotCount This property is required. Integer
The maximum number of snapshots that can be created as a backup.
rdbStorageConnectionString This property is required. String
The Connection String to the Storage Account. Only supported for Premium SKUs.
storageAccountSubscriptionId This property is required. String
The ID of the Subscription containing the Storage Account.
activeDirectoryAuthenticationEnabled This property is required. boolean
Specifies if Microsoft Entra (AAD) authentication is enabled.
aofBackupEnabled This property is required. boolean
aofStorageConnectionString0 This property is required. string
aofStorageConnectionString1 This property is required. string
authenticationEnabled This property is required. boolean
dataPersistenceAuthenticationMethod This property is required. string
maxclients This property is required. number
maxfragmentationmemoryReserved This property is required. number
Value in megabytes reserved to accommodate for memory fragmentation.
maxmemoryDelta This property is required. number
The max-memory delta for this Redis instance.
maxmemoryPolicy This property is required. string
How Redis will select what to remove when maxmemory is reached.
maxmemoryReserved This property is required. number
The value in megabytes reserved for non-cache usage e.g. failover
notifyKeyspaceEvents This property is required. string
rdbBackupEnabled This property is required. boolean
Is Backup Enabled? Only supported on Premium SKUs.
rdbBackupFrequency This property is required. number
The Backup Frequency in Minutes. Only supported on Premium SKUs.
rdbBackupMaxSnapshotCount This property is required. number
The maximum number of snapshots that can be created as a backup.
rdbStorageConnectionString This property is required. string
The Connection String to the Storage Account. Only supported for Premium SKUs.
storageAccountSubscriptionId This property is required. string
The ID of the Subscription containing the Storage Account.
active_directory_authentication_enabled This property is required. bool
Specifies if Microsoft Entra (AAD) authentication is enabled.
aof_backup_enabled This property is required. bool
aof_storage_connection_string0 This property is required. str
aof_storage_connection_string1 This property is required. str
authentication_enabled This property is required. bool
data_persistence_authentication_method This property is required. str
maxclients This property is required. int
maxfragmentationmemory_reserved This property is required. int
Value in megabytes reserved to accommodate for memory fragmentation.
maxmemory_delta This property is required. int
The max-memory delta for this Redis instance.
maxmemory_policy This property is required. str
How Redis will select what to remove when maxmemory is reached.
maxmemory_reserved This property is required. int
The value in megabytes reserved for non-cache usage e.g. failover
notify_keyspace_events This property is required. str
rdb_backup_enabled This property is required. bool
Is Backup Enabled? Only supported on Premium SKUs.
rdb_backup_frequency This property is required. int
The Backup Frequency in Minutes. Only supported on Premium SKUs.
rdb_backup_max_snapshot_count This property is required. int
The maximum number of snapshots that can be created as a backup.
rdb_storage_connection_string This property is required. str
The Connection String to the Storage Account. Only supported for Premium SKUs.
storage_account_subscription_id This property is required. str
The ID of the Subscription containing the Storage Account.
activeDirectoryAuthenticationEnabled This property is required. Boolean
Specifies if Microsoft Entra (AAD) authentication is enabled.
aofBackupEnabled This property is required. Boolean
aofStorageConnectionString0 This property is required. String
aofStorageConnectionString1 This property is required. String
authenticationEnabled This property is required. Boolean
dataPersistenceAuthenticationMethod This property is required. String
maxclients This property is required. Number
maxfragmentationmemoryReserved This property is required. Number
Value in megabytes reserved to accommodate for memory fragmentation.
maxmemoryDelta This property is required. Number
The max-memory delta for this Redis instance.
maxmemoryPolicy This property is required. String
How Redis will select what to remove when maxmemory is reached.
maxmemoryReserved This property is required. Number
The value in megabytes reserved for non-cache usage e.g. failover
notifyKeyspaceEvents This property is required. String
rdbBackupEnabled This property is required. Boolean
Is Backup Enabled? Only supported on Premium SKUs.
rdbBackupFrequency This property is required. Number
The Backup Frequency in Minutes. Only supported on Premium SKUs.
rdbBackupMaxSnapshotCount This property is required. Number
The maximum number of snapshots that can be created as a backup.
rdbStorageConnectionString This property is required. String
The Connection String to the Storage Account. Only supported for Premium SKUs.
storageAccountSubscriptionId This property is required. String
The ID of the Subscription containing the Storage Account.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi