We recommend using Azure Native.
Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi
azure.redis.getCache
Explore with Pulumi AI
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);
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)
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
	})
}
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),
    };
});
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()));
    }
}
variables:
  example:
    fn::invoke:
      function: azure:redis:getCache
      arguments:
        name: myrediscache
        resourceGroupName: redis-cache
outputs:
  primaryAccessKey: ${example.primaryAccessKey}
  hostname: ${example.hostname}
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>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]func LookupCache(ctx *Context, args *LookupCacheArgs, opts ...InvokeOption) (*LookupCacheResult, error)
func LookupCacheOutput(ctx *Context, args *LookupCacheOutputArgs, opts ...InvokeOption) LookupCacheResultOutput> 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)
}public static CompletableFuture<GetCacheResult> getCache(GetCacheArgs args, InvokeOptions options)
public static Output<GetCacheResult> getCache(GetCacheArgs args, InvokeOptions options)
fn::invoke:
  function: azure:redis/getCache:getCache
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Name string
- The name of the Redis cache
- ResourceGroup stringName 
- The name of the resource group the Redis cache instance is located in.
- Name string
- The name of the Redis cache
- ResourceGroup stringName 
- The name of the resource group the Redis cache instance is located in.
- name String
- The name of the Redis cache
- resourceGroup StringName 
- The name of the resource group the Redis cache instance is located in.
- name string
- The name of the Redis cache
- resourceGroup stringName 
- The name of the resource group the Redis cache instance is located in.
- name str
- The name of the Redis cache
- resource_group_ strname 
- The name of the resource group the Redis cache instance is located in.
- name String
- The name of the Redis cache
- resourceGroup StringName 
- The name of the resource group the Redis cache instance is located in.
getCache Result
The following output properties are available:
- AccessKeys boolAuthentication Enabled 
- 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) andP(forPremium)
- 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.
- MinimumTls stringVersion 
- The minimum TLS version.
- Name string
- NonSsl boolPort Enabled 
- PatchSchedules List<GetCache Patch Schedule> 
- A list of patch_scheduleblocks as defined below.
- Port int
- The non-SSL Port of the Redis Instance
- PrimaryAccess stringKey 
- The Primary Access Key for the Redis Instance
- PrimaryConnection stringString 
- The primary connection string of the Redis Instance.
- PrivateStatic stringIp Address 
- The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
- RedisConfigurations List<GetCache Redis Configuration> 
- A redis_configurationblock as defined below.
- ResourceGroup stringName 
- SecondaryAccess stringKey 
- The Secondary Access Key for the Redis Instance
- SecondaryConnection stringString 
- The secondary connection string of the Redis Instance.
- int
- SkuName string
- The SKU of Redis used. Possible values are Basic,StandardandPremium.
- SslPort int
- The SSL Port of the Redis Instance
- SubnetId string
- Dictionary<string, string>
- Zones List<string>
- A list of Availability Zones in which this Redis Cache is located.
- AccessKeys boolAuthentication Enabled 
- 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) andP(forPremium)
- 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.
- MinimumTls stringVersion 
- The minimum TLS version.
- Name string
- NonSsl boolPort Enabled 
- PatchSchedules []GetCache Patch Schedule 
- A list of patch_scheduleblocks as defined below.
- Port int
- The non-SSL Port of the Redis Instance
- PrimaryAccess stringKey 
- The Primary Access Key for the Redis Instance
- PrimaryConnection stringString 
- The primary connection string of the Redis Instance.
- PrivateStatic stringIp Address 
- The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
- RedisConfigurations []GetCache Redis Configuration 
- A redis_configurationblock as defined below.
- ResourceGroup stringName 
- SecondaryAccess stringKey 
- The Secondary Access Key for the Redis Instance
- SecondaryConnection stringString 
- The secondary connection string of the Redis Instance.
- int
- SkuName string
- The SKU of Redis used. Possible values are Basic,StandardandPremium.
- SslPort int
- The SSL Port of the Redis Instance
- SubnetId string
- map[string]string
- Zones []string
- A list of Availability Zones in which this Redis Cache is located.
- accessKeys BooleanAuthentication Enabled 
- 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) andP(forPremium)
- 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.
- minimumTls StringVersion 
- The minimum TLS version.
- name String
- nonSsl BooleanPort Enabled 
- patchSchedules List<GetCache Patch Schedule> 
- A list of patch_scheduleblocks as defined below.
- port Integer
- The non-SSL Port of the Redis Instance
- primaryAccess StringKey 
- The Primary Access Key for the Redis Instance
- primaryConnection StringString 
- The primary connection string of the Redis Instance.
- privateStatic StringIp Address 
- The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
- redisConfigurations List<GetCache Redis Configuration> 
- A redis_configurationblock as defined below.
- resourceGroup StringName 
- secondaryAccess StringKey 
- The Secondary Access Key for the Redis Instance
- secondaryConnection StringString 
- The secondary connection string of the Redis Instance.
- Integer
- skuName String
- The SKU of Redis used. Possible values are Basic,StandardandPremium.
- sslPort Integer
- The SSL Port of the Redis Instance
- subnetId String
- Map<String,String>
- zones List<String>
- A list of Availability Zones in which this Redis Cache is located.
- accessKeys booleanAuthentication Enabled 
- 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) andP(forPremium)
- 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.
- minimumTls stringVersion 
- The minimum TLS version.
- name string
- nonSsl booleanPort Enabled 
- patchSchedules GetCache Patch Schedule[] 
- A list of patch_scheduleblocks as defined below.
- port number
- The non-SSL Port of the Redis Instance
- primaryAccess stringKey 
- The Primary Access Key for the Redis Instance
- primaryConnection stringString 
- The primary connection string of the Redis Instance.
- privateStatic stringIp Address 
- The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
- redisConfigurations GetCache Redis Configuration[] 
- A redis_configurationblock as defined below.
- resourceGroup stringName 
- secondaryAccess stringKey 
- The Secondary Access Key for the Redis Instance
- secondaryConnection stringString 
- The secondary connection string of the Redis Instance.
- number
- skuName string
- The SKU of Redis used. Possible values are Basic,StandardandPremium.
- sslPort number
- The SSL Port of the Redis Instance
- subnetId string
- {[key: string]: string}
- zones string[]
- A list of Availability Zones in which this Redis Cache is located.
- access_keys_ boolauthentication_ enabled 
- 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) andP(forPremium)
- 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_ strversion 
- The minimum TLS version.
- name str
- non_ssl_ boolport_ enabled 
- patch_schedules Sequence[GetCache Patch Schedule] 
- A list of patch_scheduleblocks as defined below.
- port int
- The non-SSL Port of the Redis Instance
- primary_access_ strkey 
- The Primary Access Key for the Redis Instance
- primary_connection_ strstring 
- The primary connection string of the Redis Instance.
- private_static_ strip_ address 
- The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
- redis_configurations Sequence[GetCache Redis Configuration] 
- A redis_configurationblock as defined below.
- resource_group_ strname 
- secondary_access_ strkey 
- The Secondary Access Key for the Redis Instance
- secondary_connection_ strstring 
- The secondary connection string of the Redis Instance.
- int
- sku_name str
- The SKU of Redis used. Possible values are Basic,StandardandPremium.
- ssl_port int
- The SSL Port of the Redis Instance
- subnet_id str
- Mapping[str, str]
- zones Sequence[str]
- A list of Availability Zones in which this Redis Cache is located.
- accessKeys BooleanAuthentication Enabled 
- 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) andP(forPremium)
- 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.
- minimumTls StringVersion 
- The minimum TLS version.
- name String
- nonSsl BooleanPort Enabled 
- patchSchedules List<Property Map>
- A list of patch_scheduleblocks as defined below.
- port Number
- The non-SSL Port of the Redis Instance
- primaryAccess StringKey 
- The Primary Access Key for the Redis Instance
- primaryConnection StringString 
- The primary connection string of the Redis Instance.
- privateStatic StringIp Address 
- The Static IP Address assigned to the Redis Cache when hosted inside the Virtual Network.
- redisConfigurations List<Property Map>
- A redis_configurationblock as defined below.
- resourceGroup StringName 
- secondaryAccess StringKey 
- The Secondary Access Key for the Redis Instance
- secondaryConnection StringString 
- The secondary connection string of the Redis Instance.
- Number
- skuName String
- The SKU of Redis used. Possible values are Basic,StandardandPremium.
- sslPort Number
- The SSL Port of the Redis Instance
- subnetId String
- Map<String>
- zones List<String>
- A list of Availability Zones in which this Redis Cache is located.
Supporting Types
GetCachePatchSchedule   
- DayOf stringWeek 
- the Weekday name for the patch item
- MaintenanceWindow string
- The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
- StartHour intUtc 
- The Start Hour for maintenance in UTC
- DayOf stringWeek 
- the Weekday name for the patch item
- MaintenanceWindow string
- The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
- StartHour intUtc 
- The Start Hour for maintenance in UTC
- dayOf StringWeek 
- the Weekday name for the patch item
- maintenanceWindow String
- The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
- startHour IntegerUtc 
- The Start Hour for maintenance in UTC
- dayOf stringWeek 
- the Weekday name for the patch item
- maintenanceWindow string
- The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
- startHour numberUtc 
- The Start Hour for maintenance in UTC
- day_of_ strweek 
- the Weekday name for the patch item
- maintenance_window str
- The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
- start_hour_ intutc 
- The Start Hour for maintenance in UTC
- dayOf StringWeek 
- the Weekday name for the patch item
- maintenanceWindow String
- The ISO 8601 timespan which specifies the amount of time the Redis Cache can be updated.
- startHour NumberUtc 
- The Start Hour for maintenance in UTC
GetCacheRedisConfiguration   
- ActiveDirectory boolAuthentication Enabled 
- Specifies if Microsoft Entra (AAD) authentication is enabled.
- AofBackup boolEnabled 
- AofStorage stringConnection String0 
- AofStorage stringConnection String1 
- AuthenticationEnabled bool
- DataPersistence stringAuthentication Method 
- Maxclients int
- MaxfragmentationmemoryReserved int
- Value in megabytes reserved to accommodate for memory fragmentation.
- MaxmemoryDelta int
- The max-memory delta for this Redis instance.
- MaxmemoryPolicy string
- How Redis will select what to remove when maxmemoryis reached.
- MaxmemoryReserved int
- The value in megabytes reserved for non-cache usage e.g. failover
- NotifyKeyspace stringEvents 
- RdbBackup boolEnabled 
- Is Backup Enabled? Only supported on Premium SKUs.
- RdbBackup intFrequency 
- The Backup Frequency in Minutes. Only supported on Premium SKUs.
- RdbBackup intMax Snapshot Count 
- The maximum number of snapshots that can be created as a backup.
- RdbStorage stringConnection String 
- The Connection String to the Storage Account. Only supported for Premium SKUs.
- StorageAccount stringSubscription Id 
- The ID of the Subscription containing the Storage Account.
- ActiveDirectory boolAuthentication Enabled 
- Specifies if Microsoft Entra (AAD) authentication is enabled.
- AofBackup boolEnabled 
- AofStorage stringConnection String0 
- AofStorage stringConnection String1 
- AuthenticationEnabled bool
- DataPersistence stringAuthentication Method 
- Maxclients int
- MaxfragmentationmemoryReserved int
- Value in megabytes reserved to accommodate for memory fragmentation.
- MaxmemoryDelta int
- The max-memory delta for this Redis instance.
- MaxmemoryPolicy string
- How Redis will select what to remove when maxmemoryis reached.
- MaxmemoryReserved int
- The value in megabytes reserved for non-cache usage e.g. failover
- NotifyKeyspace stringEvents 
- RdbBackup boolEnabled 
- Is Backup Enabled? Only supported on Premium SKUs.
- RdbBackup intFrequency 
- The Backup Frequency in Minutes. Only supported on Premium SKUs.
- RdbBackup intMax Snapshot Count 
- The maximum number of snapshots that can be created as a backup.
- RdbStorage stringConnection String 
- The Connection String to the Storage Account. Only supported for Premium SKUs.
- StorageAccount stringSubscription Id 
- The ID of the Subscription containing the Storage Account.
- activeDirectory BooleanAuthentication Enabled 
- Specifies if Microsoft Entra (AAD) authentication is enabled.
- aofBackup BooleanEnabled 
- aofStorage StringConnection String0 
- aofStorage StringConnection String1 
- authenticationEnabled Boolean
- dataPersistence StringAuthentication Method 
- maxclients Integer
- maxfragmentationmemoryReserved Integer
- Value in megabytes reserved to accommodate for memory fragmentation.
- maxmemoryDelta Integer
- The max-memory delta for this Redis instance.
- maxmemoryPolicy String
- How Redis will select what to remove when maxmemoryis reached.
- maxmemoryReserved Integer
- The value in megabytes reserved for non-cache usage e.g. failover
- notifyKeyspace StringEvents 
- rdbBackup BooleanEnabled 
- Is Backup Enabled? Only supported on Premium SKUs.
- rdbBackup IntegerFrequency 
- The Backup Frequency in Minutes. Only supported on Premium SKUs.
- rdbBackup IntegerMax Snapshot Count 
- The maximum number of snapshots that can be created as a backup.
- rdbStorage StringConnection String 
- The Connection String to the Storage Account. Only supported for Premium SKUs.
- storageAccount StringSubscription Id 
- The ID of the Subscription containing the Storage Account.
- activeDirectory booleanAuthentication Enabled 
- Specifies if Microsoft Entra (AAD) authentication is enabled.
- aofBackup booleanEnabled 
- aofStorage stringConnection String0 
- aofStorage stringConnection String1 
- authenticationEnabled boolean
- dataPersistence stringAuthentication Method 
- maxclients number
- maxfragmentationmemoryReserved number
- Value in megabytes reserved to accommodate for memory fragmentation.
- maxmemoryDelta number
- The max-memory delta for this Redis instance.
- maxmemoryPolicy string
- How Redis will select what to remove when maxmemoryis reached.
- maxmemoryReserved number
- The value in megabytes reserved for non-cache usage e.g. failover
- notifyKeyspace stringEvents 
- rdbBackup booleanEnabled 
- Is Backup Enabled? Only supported on Premium SKUs.
- rdbBackup numberFrequency 
- The Backup Frequency in Minutes. Only supported on Premium SKUs.
- rdbBackup numberMax Snapshot Count 
- The maximum number of snapshots that can be created as a backup.
- rdbStorage stringConnection String 
- The Connection String to the Storage Account. Only supported for Premium SKUs.
- storageAccount stringSubscription Id 
- The ID of the Subscription containing the Storage Account.
- active_directory_ boolauthentication_ enabled 
- Specifies if Microsoft Entra (AAD) authentication is enabled.
- aof_backup_ boolenabled 
- aof_storage_ strconnection_ string0 
- aof_storage_ strconnection_ string1 
- authentication_enabled bool
- data_persistence_ strauthentication_ method 
- maxclients int
- maxfragmentationmemory_reserved int
- Value in megabytes reserved to accommodate for memory fragmentation.
- maxmemory_delta int
- The max-memory delta for this Redis instance.
- maxmemory_policy str
- How Redis will select what to remove when maxmemoryis reached.
- maxmemory_reserved int
- The value in megabytes reserved for non-cache usage e.g. failover
- notify_keyspace_ strevents 
- rdb_backup_ boolenabled 
- Is Backup Enabled? Only supported on Premium SKUs.
- rdb_backup_ intfrequency 
- The Backup Frequency in Minutes. Only supported on Premium SKUs.
- rdb_backup_ intmax_ snapshot_ count 
- The maximum number of snapshots that can be created as a backup.
- rdb_storage_ strconnection_ string 
- The Connection String to the Storage Account. Only supported for Premium SKUs.
- storage_account_ strsubscription_ id 
- The ID of the Subscription containing the Storage Account.
- activeDirectory BooleanAuthentication Enabled 
- Specifies if Microsoft Entra (AAD) authentication is enabled.
- aofBackup BooleanEnabled 
- aofStorage StringConnection String0 
- aofStorage StringConnection String1 
- authenticationEnabled Boolean
- dataPersistence StringAuthentication Method 
- maxclients Number
- maxfragmentationmemoryReserved Number
- Value in megabytes reserved to accommodate for memory fragmentation.
- maxmemoryDelta Number
- The max-memory delta for this Redis instance.
- maxmemoryPolicy String
- How Redis will select what to remove when maxmemoryis reached.
- maxmemoryReserved Number
- The value in megabytes reserved for non-cache usage e.g. failover
- notifyKeyspace StringEvents 
- rdbBackup BooleanEnabled 
- Is Backup Enabled? Only supported on Premium SKUs.
- rdbBackup NumberFrequency 
- The Backup Frequency in Minutes. Only supported on Premium SKUs.
- rdbBackup NumberMax Snapshot Count 
- The maximum number of snapshots that can be created as a backup.
- rdbStorage StringConnection String 
- The Connection String to the Storage Account. Only supported for Premium SKUs.
- storageAccount StringSubscription Id 
- 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 azurermTerraform Provider.