Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,30 +260,34 @@ If you're new to [Bicep](https://learn.microsoft.com/azure/azure-resource-manage
@description('The location for the resource(s) to be deployed.')
param location string = resourceGroup().location

resource cache 'Microsoft.Cache/redis@2024-11-01' = {
resource cache 'Microsoft.Cache/redisEnterprise@2025-07-01' = {
name: take('cache-${uniqueString(resourceGroup().id)}', 63)
location: location
sku: {
name: 'Balanced_B0'
}
properties: {
sku: {
name: 'Basic'
family: 'C'
capacity: 1
}
enableNonSslPort: false
disableAccessKeyAuthentication: true
minimumTlsVersion: '1.2'
redisConfiguration: {
'aad-enabled': 'true'
}
publicNetworkAccess: 'Enabled'
}
tags: {
'aspire-resource-name': 'cache'
}

resource cache_default 'Microsoft.Cache/redisEnterprise/databases@2025-07-01' = {
name: 'default'
properties: {
accessKeysAuthentication: 'Disabled'
port: 10000
}
parent: cache
}

output connectionString string = '${cache.properties.hostName},ssl=true'
output connectionString string = '${cache.properties.hostName}:10000,ssl=true'

output name string = cache.name

output id string = cache.id

output hostName string = cache.properties.hostName
```

In addition, role assignments are created for the Azure resource in a separate module:
Expand All @@ -296,20 +300,24 @@ param cache_outputs_name string

param principalId string

param principalName string

resource cache 'Microsoft.Cache/redis@2024-11-01' existing = {
resource cache 'Microsoft.Cache/redisEnterprise@2025-07-01' existing = {
name: cache_outputs_name
}

resource cache_contributor 'Microsoft.Cache/redis/accessPolicyAssignments@2024-11-01' = {
name: guid(cache.id, principalId, 'Data Contributor')
resource cache_default 'Microsoft.Cache/redisEnterprise/databases@2025-07-01' existing = {
name: 'default'
parent: cache
}

resource cache_default_contributor 'Microsoft.Cache/redisEnterprise/databases/accessPolicyAssignments@2025-07-01' = {
name: guid(cache_default.id, principalId, 'default')
properties: {
accessPolicyName: 'Data Contributor'
objectId: principalId
objectIdAlias: principalName
accessPolicyName: 'default'
user: {
objectId: principalId
}
}
parent: cache
parent: cache_default
}
Comment on lines +312 to 321
```

Expand All @@ -328,13 +336,12 @@ builder.AddAzureManagedRedis("cache")
.ConfigureInfrastructure(infra =>
{
var redisCache = infra.GetProvisionableResources()
.OfType<RedisCache>()
.OfType<RedisEnterpriseCluster>()
.Single();

redisCache.Sku = new RedisSku
redisCache.Sku = new RedisEnterpriseSku
{
Name = RedisSkuName.Standard,
Family = RedisSkuFamily.C,
Name = RedisEnterpriseSkuName.BalancedB1,
Capacity = 1,
};
Comment on lines +342 to 346
redisCache.Tags.Add("ExampleKey", "Example value");
Expand All @@ -354,7 +361,7 @@ await builder.addAzureManagedRedis("cache")
.configureInfrastructure(async (infra) => {
// Use the AzureResourceInfrastructure API to customize Bicep
// parameters or resources directly.
await infra.addParameter("skuName", "Standard");
await infra.addParameter("skuName", "BalancedB1");
});

// After adding all resources, run the app...
Expand All @@ -363,7 +370,7 @@ await builder.build().run();
</TabItem>
</Tabs>

The preceding C# code retrieves the `RedisCache` resource from the infrastructure and updates the SKU to `Standard` tier with capacity 1, then adds a tag. The TypeScript AppHost exposes the same `configureInfrastructure` API for adding Bicep parameters and customizing resource configuration.
The preceding C# code retrieves the `RedisEnterpriseCluster` resource from the infrastructure and updates the SKU to `BalancedB1` tier with capacity 1, then adds a tag. The TypeScript AppHost exposes the same `configureInfrastructure` API for adding Bicep parameters and customizing resource configuration.

For more configuration options, see [Azure.Provisioning customization](/integrations/cloud/azure/customize-resources/#azureprovisioning-customization).

Expand Down