Créez ou remplacez (remplacez/recréez, avec un temps d’arrêt potentiel) un cache Redis existant.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}?api-version=2024-11-01
Paramètres URI
Nom |
Dans |
Obligatoire |
Type |
Description |
name
|
path |
True
|
string
|
Nom du cache Redis.
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Nom du groupe de ressources. Le nom ne respecte pas la casse.
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
ID de l’abonnement cible.
|
api-version
|
query |
True
|
string
minLength: 1
|
Version de l’API à utiliser pour cette opération.
|
Corps de la demande
Nom |
Obligatoire |
Type |
Description |
location
|
True
|
string
|
Emplacement géographique où réside la ressource
|
properties.sku
|
True
|
Sku
|
Référence SKU du cache Redis à déployer.
|
identity
|
|
ManagedServiceIdentity
|
Identité de la ressource.
|
properties.disableAccessKeyAuthentication
|
|
boolean
|
L’authentification auprès de Redis par le biais de clés d’accès est désactivée lorsqu’elle est définie sur true. La valeur par défaut est false.
|
properties.enableNonSslPort
|
|
boolean
|
Spécifie si le port du serveur Redis non ssl (6379) est activé.
|
properties.minimumTlsVersion
|
|
TlsVersion
|
Facultatif : nécessite que les clients utilisent une version TLS spécifiée (ou une version ultérieure) pour se connecter (par exemple, « 1.0 », « 1.1 », « 1.2 »)
|
properties.publicNetworkAccess
|
|
PublicNetworkAccess
|
Indique si l’accès au point de terminaison public est autorisé pour ce cache. La valeur est facultative, mais si elle est passée, doit être « Activé » ou « Désactivé ». Si « Désactivé », les points de terminaison privés sont la méthode d’accès exclusif. La valeur par défaut est « Enabled »
|
properties.redisConfiguration
|
|
RedisConfiguration
|
Tous les paramètres Redis. Peu de clés possibles : rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-string-1, etc.
|
properties.redisVersion
|
|
string
|
Version de Redis. Il doit s’agir de la forme « major[.minor] » (seul « major » est requis) ou de la valeur « latest » qui fait référence à la dernière version stable de Redis disponible. Versions prises en charge : 4.0, 6.0 (dernière version). La valeur par défaut est « latest ».
|
properties.replicasPerMaster
|
|
integer
(int32)
|
Nombre de réplicas à créer par réplica principal.
|
properties.replicasPerPrimary
|
|
integer
(int32)
|
Nombre de réplicas à créer par réplica principal.
|
properties.shardCount
|
|
integer
(int32)
|
Nombre de partitions à créer sur un cache de cluster Premium.
|
properties.staticIP
|
|
string
pattern: ^\d+\.\d+\.\d+\.\d+$
|
Adresse IP statique. Si vous le souhaitez, vous pouvez spécifier le déploiement d’un cache Redis à l’intérieur d’un réseau virtuel Azure existant ; automatiquement affecté par défaut.
|
properties.subnetId
|
|
string
pattern: ^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$
|
ID de ressource complet d’un sous-réseau dans un réseau virtuel dans lequel déployer le cache Redis. Exemple de format : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft. {Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1
|
properties.tenantSettings
|
|
object
|
Dictionnaire des paramètres de locataire
|
properties.updateChannel
|
|
UpdateChannel
|
Facultatif : spécifie le canal de mise à jour pour les mises à jour mensuelles de Redis que votre cache Redis recevra. Les caches utilisant le canal de mise à jour « Préversion » obtiennent les dernières mises à jour Redis au moins 4 semaines à l’avance sur les caches de canal « Stable ». La valeur par défaut est « Stable ».
|
properties.zonalAllocationPolicy
|
|
ZonalAllocationPolicy
|
Facultatif : spécifie la façon dont les zones de disponibilité sont allouées au cache Redis. « Automatique » active la redondance de zone et Azure sélectionne automatiquement les zones en fonction de la disponibilité et de la capacité régionales. « UserDefined » sélectionne les zones de disponibilité transmises par vous à l’aide du paramètre « zones ». 'NoZones' produit un cache non zonal. Si « zonalAllocationPolicy » n’est pas passé, il est défini sur « UserDefined » lorsque les zones sont passées ; sinon, elle est définie sur « Automatique » dans les régions où les zones sont prises en charge et « NoZones » dans les régions où les zones ne sont pas prises en charge.
|
tags
|
|
object
|
Balises de ressource.
|
zones
|
|
string[]
|
Liste des zones de disponibilité indiquant à partir de laquelle la ressource doit provenir.
|
Réponses
Nom |
Type |
Description |
200 OK
|
RedisResource
|
Le cache redis existant a été correctement mis à jour. Vérifiez provisioningState pour afficher l’état détaillé.
|
201 Created
|
RedisResource
|
Le nouveau cache redis a été créé avec succès. Vérifiez provisioningState pour afficher l’état détaillé.
|
Other Status Codes
|
ErrorResponse
|
Réponse d’erreur décrivant pourquoi l’opération a échoué.
|
Sécurité
azure_auth
Flux OAuth2 Azure Active Directory.
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
Nom |
Description |
user_impersonation
|
emprunter l’identité de votre compte d’utilisateur
|
Exemples
RedisCacheCreate
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/cache1?api-version=2024-11-01
{
"location": "East US",
"zones": [
"1"
],
"properties": {
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"redisVersion": "4",
"enableNonSslPort": true,
"shardCount": 2,
"replicasPerPrimary": 2,
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
"staticIP": "192.168.0.5",
"minimumTlsVersion": "1.2"
}
}
import com.azure.resourcemanager.redis.models.RedisConfiguration;
import com.azure.resourcemanager.redis.models.RedisCreateParameters;
import com.azure.resourcemanager.redis.models.Sku;
import com.azure.resourcemanager.redis.models.SkuFamily;
import com.azure.resourcemanager.redis.models.SkuName;
import com.azure.resourcemanager.redis.models.TlsVersion;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Redis Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreate.json
*/
/**
* Sample code: RedisCacheCreate.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void redisCacheCreate(com.azure.resourcemanager.AzureResourceManager azure) {
azure.redisCaches().manager().serviceClient().getRedis().create("rg1", "cache1", new RedisCreateParameters()
.withZones(Arrays.asList("1")).withLocation("East US")
.withSku(new Sku().withName(SkuName.PREMIUM).withFamily(SkuFamily.P).withCapacity(1))
.withSubnetId(
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1")
.withStaticIp("192.168.0.5")
.withRedisConfiguration(
new RedisConfiguration().withMaxmemoryPolicy("allkeys-lru").withAdditionalProperties(mapOf()))
.withRedisVersion("4").withEnableNonSslPort(true).withReplicasPerPrimary(2).withShardCount(2)
.withMinimumTlsVersion(TlsVersion.ONE_TWO), com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.redis import RedisManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redis
# USAGE
python redis_cache_create.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.redis.begin_create(
resource_group_name="rg1",
name="cache1",
parameters={
"location": "East US",
"properties": {
"enableNonSslPort": True,
"minimumTlsVersion": "1.2",
"redisConfiguration": {"maxmemory-policy": "allkeys-lru"},
"redisVersion": "4",
"replicasPerPrimary": 2,
"shardCount": 2,
"sku": {"capacity": 1, "family": "P", "name": "Premium"},
"staticIP": "192.168.0.5",
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
},
"zones": ["1"],
},
).result()
print(response)
# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armredis_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/45374f48f560b3337ed55735038f1e9bf8cbea65/specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreate.json
func ExampleClient_BeginCreate_redisCacheCreate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armredis.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreate(ctx, "rg1", "cache1", armredis.CreateParameters{
Location: to.Ptr("East US"),
Properties: &armredis.CreateProperties{
EnableNonSSLPort: to.Ptr(true),
MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
MaxmemoryPolicy: to.Ptr("allkeys-lru"),
},
RedisVersion: to.Ptr("4"),
ReplicasPerPrimary: to.Ptr[int32](2),
ShardCount: to.Ptr[int32](2),
SKU: &armredis.SKU{
Name: to.Ptr(armredis.SKUNamePremium),
Capacity: to.Ptr[int32](1),
Family: to.Ptr(armredis.SKUFamilyP),
},
StaticIP: to.Ptr("192.168.0.5"),
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
},
Zones: []*string{
to.Ptr("1")},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ResourceInfo = armredis.ResourceInfo{
// Name: to.Ptr("cache1"),
// Type: to.Ptr("Microsoft.Cache/Redis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1"),
// Location: to.Ptr("West US"),
// Tags: map[string]*string{
// },
// Properties: &armredis.Properties{
// EnableNonSSLPort: to.Ptr(false),
// MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
// RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
// Maxclients: to.Ptr("1000"),
// MaxmemoryDelta: to.Ptr("50"),
// MaxmemoryReserved: to.Ptr("50"),
// },
// RedisVersion: to.Ptr("4.0.14"),
// ReplicasPerMaster: to.Ptr[int32](2),
// ReplicasPerPrimary: to.Ptr[int32](2),
// UpdateChannel: to.Ptr(armredis.UpdateChannelStable),
// ZonalAllocationPolicy: to.Ptr(armredis.ZonalAllocationPolicyUserDefined),
// SKU: &armredis.SKU{
// Name: to.Ptr(armredis.SKUNamePremium),
// Capacity: to.Ptr[int32](1),
// Family: to.Ptr(armredis.SKUFamilyP),
// },
// AccessKeys: &armredis.AccessKeys{
// PrimaryKey: to.Ptr("<primaryKey>"),
// SecondaryKey: to.Ptr("<secondaryKey>"),
// },
// HostName: to.Ptr("cache1.redis.cache.windows.net"),
// Instances: []*armredis.InstanceDetails{
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13000),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15000),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13001),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15001),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13002),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15002),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13003),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15003),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13004),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15004),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13005),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15005),
// Zone: to.Ptr("1"),
// }},
// Port: to.Ptr[int32](6379),
// ProvisioningState: to.Ptr(armredis.ProvisioningStateSucceeded),
// SSLPort: to.Ptr[int32](6380),
// },
// Zones: []*string{
// to.Ptr("1")},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RedisManagementClient } = require("@azure/arm-rediscache");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
*
* @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
* x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreate.json
*/
async function redisCacheCreate() {
const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1";
const name = "cache1";
const parameters = {
enableNonSslPort: true,
location: "East US",
minimumTlsVersion: "1.2",
redisConfiguration: { maxmemoryPolicy: "allkeys-lru" },
redisVersion: "4",
replicasPerPrimary: 2,
shardCount: 2,
sku: { name: "Premium", capacity: 1, family: "P" },
staticIP: "192.168.0.5",
subnetId:
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new RedisManagementClient(credential, subscriptionId);
const result = await client.redis.beginCreateAndWait(resourceGroupName, name, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Net;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Redis.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Redis;
// Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreate.json
// this example is just showing the usage of "Redis_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this RedisResource
RedisCollection collection = resourceGroupResource.GetAllRedis();
// invoke the operation
string name = "cache1";
RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1))
{
Zones = { "1" },
RedisConfiguration = new RedisCommonConfiguration
{
MaxMemoryPolicy = "allkeys-lru",
},
RedisVersion = "4",
EnableNonSslPort = true,
ReplicasPerPrimary = 2,
ShardCount = 2,
MinimumTlsVersion = RedisTlsVersion.Tls1_2,
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
StaticIP = IPAddress.Parse("192.168.0.5"),
};
ArmOperation<RedisResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content);
RedisResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
RedisData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "West US",
"zones": [
"1"
],
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "4.0.14",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": false,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "UserDefined",
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"zone": "1",
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"zone": "1",
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "West US",
"zones": [
"1"
],
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "4.0.14",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": false,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "UserDefined",
"redisConfiguration": {
"maxclients": "1000",
"maxmemory-reserved": "50",
"maxmemory-delta": "50"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"zone": "1",
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"zone": "1",
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
RedisCacheCreateAutomaticZonalAllocationPolicy
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/cache1?api-version=2024-11-01
{
"location": "East US",
"properties": {
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": true,
"shardCount": 2,
"replicasPerPrimary": 2,
"zonalAllocationPolicy": "Automatic",
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
"staticIP": "192.168.0.5",
"minimumTlsVersion": "1.2"
}
}
import com.azure.resourcemanager.redis.models.RedisConfiguration;
import com.azure.resourcemanager.redis.models.RedisCreateParameters;
import com.azure.resourcemanager.redis.models.Sku;
import com.azure.resourcemanager.redis.models.SkuFamily;
import com.azure.resourcemanager.redis.models.SkuName;
import com.azure.resourcemanager.redis.models.TlsVersion;
import com.azure.resourcemanager.redis.models.ZonalAllocationPolicy;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Redis Create.
*/
public final class Main {
/*
* x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/
* RedisCacheCreateAutomaticZonalAllocationPolicy.json
*/
/**
* Sample code: RedisCacheCreateAutomaticZonalAllocationPolicy.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
redisCacheCreateAutomaticZonalAllocationPolicy(com.azure.resourcemanager.AzureResourceManager azure) {
azure.redisCaches().manager().serviceClient().getRedis().create("rg1", "cache1", new RedisCreateParameters()
.withLocation("East US")
.withSku(new Sku().withName(SkuName.PREMIUM).withFamily(SkuFamily.P).withCapacity(1))
.withSubnetId(
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1")
.withStaticIp("192.168.0.5")
.withRedisConfiguration(
new RedisConfiguration().withMaxmemoryPolicy("allkeys-lru").withAdditionalProperties(mapOf()))
.withEnableNonSslPort(true).withReplicasPerPrimary(2).withShardCount(2)
.withMinimumTlsVersion(TlsVersion.ONE_TWO).withZonalAllocationPolicy(ZonalAllocationPolicy.AUTOMATIC),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.redis import RedisManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redis
# USAGE
python redis_cache_create_automatic_zonal_allocation_policy.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.redis.begin_create(
resource_group_name="rg1",
name="cache1",
parameters={
"location": "East US",
"properties": {
"enableNonSslPort": True,
"minimumTlsVersion": "1.2",
"redisConfiguration": {"maxmemory-policy": "allkeys-lru"},
"replicasPerPrimary": 2,
"shardCount": 2,
"sku": {"capacity": 1, "family": "P", "name": "Premium"},
"staticIP": "192.168.0.5",
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
"zonalAllocationPolicy": "Automatic",
},
},
).result()
print(response)
# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateAutomaticZonalAllocationPolicy.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armredis_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/45374f48f560b3337ed55735038f1e9bf8cbea65/specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateAutomaticZonalAllocationPolicy.json
func ExampleClient_BeginCreate_redisCacheCreateAutomaticZonalAllocationPolicy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armredis.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreate(ctx, "rg1", "cache1", armredis.CreateParameters{
Location: to.Ptr("East US"),
Properties: &armredis.CreateProperties{
EnableNonSSLPort: to.Ptr(true),
MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
MaxmemoryPolicy: to.Ptr("allkeys-lru"),
},
ReplicasPerPrimary: to.Ptr[int32](2),
ShardCount: to.Ptr[int32](2),
ZonalAllocationPolicy: to.Ptr(armredis.ZonalAllocationPolicyAutomatic),
SKU: &armredis.SKU{
Name: to.Ptr(armredis.SKUNamePremium),
Capacity: to.Ptr[int32](1),
Family: to.Ptr(armredis.SKUFamilyP),
},
StaticIP: to.Ptr("192.168.0.5"),
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ResourceInfo = armredis.ResourceInfo{
// Name: to.Ptr("cache1"),
// Type: to.Ptr("Microsoft.Cache/Redis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1"),
// Location: to.Ptr("East US"),
// Tags: map[string]*string{
// },
// Properties: &armredis.Properties{
// EnableNonSSLPort: to.Ptr(true),
// MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
// RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
// Maxclients: to.Ptr("1000"),
// MaxmemoryDelta: to.Ptr("50"),
// MaxmemoryReserved: to.Ptr("50"),
// },
// RedisVersion: to.Ptr("6.0"),
// ReplicasPerMaster: to.Ptr[int32](2),
// ReplicasPerPrimary: to.Ptr[int32](2),
// ShardCount: to.Ptr[int32](2),
// UpdateChannel: to.Ptr(armredis.UpdateChannelStable),
// ZonalAllocationPolicy: to.Ptr(armredis.ZonalAllocationPolicyAutomatic),
// SKU: &armredis.SKU{
// Name: to.Ptr(armredis.SKUNamePremium),
// Capacity: to.Ptr[int32](1),
// Family: to.Ptr(armredis.SKUFamilyP),
// },
// AccessKeys: &armredis.AccessKeys{
// PrimaryKey: to.Ptr("<primaryKey>"),
// SecondaryKey: to.Ptr("<secondaryKey>"),
// },
// HostName: to.Ptr("cache1.redis.cache.windows.net"),
// Instances: []*armredis.InstanceDetails{
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13000),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15000),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13001),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15001),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13002),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15002),
// },
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13003),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15003),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13004),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15004),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13005),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15005),
// }},
// Port: to.Ptr[int32](6379),
// ProvisioningState: to.Ptr(armredis.ProvisioningStateSucceeded),
// SSLPort: to.Ptr[int32](6380),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RedisManagementClient } = require("@azure/arm-rediscache");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
*
* @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
* x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateAutomaticZonalAllocationPolicy.json
*/
async function redisCacheCreateAutomaticZonalAllocationPolicy() {
const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1";
const name = "cache1";
const parameters = {
enableNonSslPort: true,
location: "East US",
minimumTlsVersion: "1.2",
redisConfiguration: { maxmemoryPolicy: "allkeys-lru" },
replicasPerPrimary: 2,
shardCount: 2,
sku: { name: "Premium", capacity: 1, family: "P" },
staticIP: "192.168.0.5",
subnetId:
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
zonalAllocationPolicy: "Automatic",
};
const credential = new DefaultAzureCredential();
const client = new RedisManagementClient(credential, subscriptionId);
const result = await client.redis.beginCreateAndWait(resourceGroupName, name, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Net;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Redis.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Redis;
// Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateAutomaticZonalAllocationPolicy.json
// this example is just showing the usage of "Redis_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this RedisResource
RedisCollection collection = resourceGroupResource.GetAllRedis();
// invoke the operation
string name = "cache1";
RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1))
{
RedisConfiguration = new RedisCommonConfiguration
{
MaxMemoryPolicy = "allkeys-lru",
},
EnableNonSslPort = true,
ReplicasPerPrimary = 2,
ShardCount = 2,
MinimumTlsVersion = RedisTlsVersion.Tls1_2,
ZonalAllocationPolicy = ZonalAllocationPolicy.Automatic,
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
StaticIP = IPAddress.Parse("192.168.0.5"),
};
ArmOperation<RedisResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content);
RedisResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
RedisData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "East US",
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"shardCount": 2,
"enableNonSslPort": true,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "Automatic",
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "East US",
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"shardCount": 2,
"enableNonSslPort": true,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "Automatic",
"redisConfiguration": {
"maxclients": "1000",
"maxmemory-reserved": "50",
"maxmemory-delta": "50"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
RedisCacheCreateDefaultVersion
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/cache1?api-version=2024-11-01
{
"location": "East US",
"zones": [
"1"
],
"properties": {
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": true,
"shardCount": 2,
"replicasPerPrimary": 2,
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
"staticIP": "192.168.0.5",
"minimumTlsVersion": "1.2"
}
}
import com.azure.resourcemanager.redis.models.RedisConfiguration;
import com.azure.resourcemanager.redis.models.RedisCreateParameters;
import com.azure.resourcemanager.redis.models.Sku;
import com.azure.resourcemanager.redis.models.SkuFamily;
import com.azure.resourcemanager.redis.models.SkuName;
import com.azure.resourcemanager.redis.models.TlsVersion;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Redis Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateDefaultVersion.
* json
*/
/**
* Sample code: RedisCacheCreateDefaultVersion.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void redisCacheCreateDefaultVersion(com.azure.resourcemanager.AzureResourceManager azure) {
azure.redisCaches().manager().serviceClient().getRedis().create("rg1", "cache1", new RedisCreateParameters()
.withZones(Arrays.asList("1")).withLocation("East US")
.withSku(new Sku().withName(SkuName.PREMIUM).withFamily(SkuFamily.P).withCapacity(1))
.withSubnetId(
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1")
.withStaticIp("192.168.0.5")
.withRedisConfiguration(
new RedisConfiguration().withMaxmemoryPolicy("allkeys-lru").withAdditionalProperties(mapOf()))
.withEnableNonSslPort(true).withReplicasPerPrimary(2).withShardCount(2)
.withMinimumTlsVersion(TlsVersion.ONE_TWO), com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.redis import RedisManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redis
# USAGE
python redis_cache_create_default_version.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.redis.begin_create(
resource_group_name="rg1",
name="cache1",
parameters={
"location": "East US",
"properties": {
"enableNonSslPort": True,
"minimumTlsVersion": "1.2",
"redisConfiguration": {"maxmemory-policy": "allkeys-lru"},
"replicasPerPrimary": 2,
"shardCount": 2,
"sku": {"capacity": 1, "family": "P", "name": "Premium"},
"staticIP": "192.168.0.5",
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
},
"zones": ["1"],
},
).result()
print(response)
# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateDefaultVersion.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armredis_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/45374f48f560b3337ed55735038f1e9bf8cbea65/specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateDefaultVersion.json
func ExampleClient_BeginCreate_redisCacheCreateDefaultVersion() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armredis.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreate(ctx, "rg1", "cache1", armredis.CreateParameters{
Location: to.Ptr("East US"),
Properties: &armredis.CreateProperties{
EnableNonSSLPort: to.Ptr(true),
MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
MaxmemoryPolicy: to.Ptr("allkeys-lru"),
},
ReplicasPerPrimary: to.Ptr[int32](2),
ShardCount: to.Ptr[int32](2),
SKU: &armredis.SKU{
Name: to.Ptr(armredis.SKUNamePremium),
Capacity: to.Ptr[int32](1),
Family: to.Ptr(armredis.SKUFamilyP),
},
StaticIP: to.Ptr("192.168.0.5"),
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
},
Zones: []*string{
to.Ptr("1")},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ResourceInfo = armredis.ResourceInfo{
// Name: to.Ptr("cache1"),
// Type: to.Ptr("Microsoft.Cache/Redis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1"),
// Location: to.Ptr("West US"),
// Tags: map[string]*string{
// },
// Properties: &armredis.Properties{
// EnableNonSSLPort: to.Ptr(false),
// MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
// RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
// Maxclients: to.Ptr("1000"),
// MaxmemoryDelta: to.Ptr("50"),
// MaxmemoryReserved: to.Ptr("50"),
// },
// RedisVersion: to.Ptr("6.0.14"),
// ReplicasPerMaster: to.Ptr[int32](2),
// ReplicasPerPrimary: to.Ptr[int32](2),
// UpdateChannel: to.Ptr(armredis.UpdateChannelStable),
// ZonalAllocationPolicy: to.Ptr(armredis.ZonalAllocationPolicyUserDefined),
// SKU: &armredis.SKU{
// Name: to.Ptr(armredis.SKUNamePremium),
// Capacity: to.Ptr[int32](1),
// Family: to.Ptr(armredis.SKUFamilyP),
// },
// AccessKeys: &armredis.AccessKeys{
// PrimaryKey: to.Ptr("<primaryKey>"),
// SecondaryKey: to.Ptr("<secondaryKey>"),
// },
// HostName: to.Ptr("cache1.redis.cache.windows.net"),
// Instances: []*armredis.InstanceDetails{
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13000),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15000),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13001),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15001),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13002),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15002),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13003),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15003),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13004),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15004),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13005),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15005),
// Zone: to.Ptr("1"),
// }},
// Port: to.Ptr[int32](6379),
// ProvisioningState: to.Ptr(armredis.ProvisioningStateSucceeded),
// SSLPort: to.Ptr[int32](6380),
// },
// Zones: []*string{
// to.Ptr("1")},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RedisManagementClient } = require("@azure/arm-rediscache");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
*
* @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
* x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateDefaultVersion.json
*/
async function redisCacheCreateDefaultVersion() {
const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1";
const name = "cache1";
const parameters = {
enableNonSslPort: true,
location: "East US",
minimumTlsVersion: "1.2",
redisConfiguration: { maxmemoryPolicy: "allkeys-lru" },
replicasPerPrimary: 2,
shardCount: 2,
sku: { name: "Premium", capacity: 1, family: "P" },
staticIP: "192.168.0.5",
subnetId:
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new RedisManagementClient(credential, subscriptionId);
const result = await client.redis.beginCreateAndWait(resourceGroupName, name, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Net;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Redis.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Redis;
// Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateDefaultVersion.json
// this example is just showing the usage of "Redis_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this RedisResource
RedisCollection collection = resourceGroupResource.GetAllRedis();
// invoke the operation
string name = "cache1";
RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1))
{
Zones = { "1" },
RedisConfiguration = new RedisCommonConfiguration
{
MaxMemoryPolicy = "allkeys-lru",
},
EnableNonSslPort = true,
ReplicasPerPrimary = 2,
ShardCount = 2,
MinimumTlsVersion = RedisTlsVersion.Tls1_2,
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
StaticIP = IPAddress.Parse("192.168.0.5"),
};
ArmOperation<RedisResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content);
RedisResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
RedisData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "West US",
"zones": [
"1"
],
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0.14",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": false,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "UserDefined",
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"zone": "1",
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"zone": "1",
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "West US",
"zones": [
"1"
],
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0.14",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": false,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "UserDefined",
"redisConfiguration": {
"maxclients": "1000",
"maxmemory-reserved": "50",
"maxmemory-delta": "50"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"zone": "1",
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"zone": "1",
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
RedisCacheCreateLatestVersion
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/cache1?api-version=2024-11-01
{
"location": "East US",
"zones": [
"1"
],
"properties": {
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"redisVersion": "Latest",
"enableNonSslPort": true,
"shardCount": 2,
"replicasPerPrimary": 2,
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
"staticIP": "192.168.0.5",
"minimumTlsVersion": "1.2"
}
}
import com.azure.resourcemanager.redis.models.RedisConfiguration;
import com.azure.resourcemanager.redis.models.RedisCreateParameters;
import com.azure.resourcemanager.redis.models.Sku;
import com.azure.resourcemanager.redis.models.SkuFamily;
import com.azure.resourcemanager.redis.models.SkuName;
import com.azure.resourcemanager.redis.models.TlsVersion;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Redis Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateLatestVersion.
* json
*/
/**
* Sample code: RedisCacheCreateLatestVersion.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void redisCacheCreateLatestVersion(com.azure.resourcemanager.AzureResourceManager azure) {
azure.redisCaches().manager().serviceClient().getRedis().create("rg1", "cache1", new RedisCreateParameters()
.withZones(Arrays.asList("1")).withLocation("East US")
.withSku(new Sku().withName(SkuName.PREMIUM).withFamily(SkuFamily.P).withCapacity(1))
.withSubnetId(
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1")
.withStaticIp("192.168.0.5")
.withRedisConfiguration(
new RedisConfiguration().withMaxmemoryPolicy("allkeys-lru").withAdditionalProperties(mapOf()))
.withRedisVersion("Latest").withEnableNonSslPort(true).withReplicasPerPrimary(2).withShardCount(2)
.withMinimumTlsVersion(TlsVersion.ONE_TWO), com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.redis import RedisManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redis
# USAGE
python redis_cache_create_latest_version.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.redis.begin_create(
resource_group_name="rg1",
name="cache1",
parameters={
"location": "East US",
"properties": {
"enableNonSslPort": True,
"minimumTlsVersion": "1.2",
"redisConfiguration": {"maxmemory-policy": "allkeys-lru"},
"redisVersion": "Latest",
"replicasPerPrimary": 2,
"shardCount": 2,
"sku": {"capacity": 1, "family": "P", "name": "Premium"},
"staticIP": "192.168.0.5",
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
},
"zones": ["1"],
},
).result()
print(response)
# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateLatestVersion.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armredis_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/45374f48f560b3337ed55735038f1e9bf8cbea65/specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateLatestVersion.json
func ExampleClient_BeginCreate_redisCacheCreateLatestVersion() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armredis.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreate(ctx, "rg1", "cache1", armredis.CreateParameters{
Location: to.Ptr("East US"),
Properties: &armredis.CreateProperties{
EnableNonSSLPort: to.Ptr(true),
MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
MaxmemoryPolicy: to.Ptr("allkeys-lru"),
},
RedisVersion: to.Ptr("Latest"),
ReplicasPerPrimary: to.Ptr[int32](2),
ShardCount: to.Ptr[int32](2),
SKU: &armredis.SKU{
Name: to.Ptr(armredis.SKUNamePremium),
Capacity: to.Ptr[int32](1),
Family: to.Ptr(armredis.SKUFamilyP),
},
StaticIP: to.Ptr("192.168.0.5"),
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
},
Zones: []*string{
to.Ptr("1")},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ResourceInfo = armredis.ResourceInfo{
// Name: to.Ptr("cache1"),
// Type: to.Ptr("Microsoft.Cache/Redis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1"),
// Location: to.Ptr("West US"),
// Tags: map[string]*string{
// },
// Properties: &armredis.Properties{
// EnableNonSSLPort: to.Ptr(false),
// MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
// RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
// Maxclients: to.Ptr("1000"),
// MaxmemoryDelta: to.Ptr("50"),
// MaxmemoryReserved: to.Ptr("50"),
// },
// RedisVersion: to.Ptr("6.0.14"),
// ReplicasPerMaster: to.Ptr[int32](2),
// ReplicasPerPrimary: to.Ptr[int32](2),
// UpdateChannel: to.Ptr(armredis.UpdateChannelStable),
// ZonalAllocationPolicy: to.Ptr(armredis.ZonalAllocationPolicyUserDefined),
// SKU: &armredis.SKU{
// Name: to.Ptr(armredis.SKUNamePremium),
// Capacity: to.Ptr[int32](1),
// Family: to.Ptr(armredis.SKUFamilyP),
// },
// AccessKeys: &armredis.AccessKeys{
// PrimaryKey: to.Ptr("<primaryKey>"),
// SecondaryKey: to.Ptr("<secondaryKey>"),
// },
// HostName: to.Ptr("cache1.redis.cache.windows.net"),
// Instances: []*armredis.InstanceDetails{
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13000),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15000),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13001),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15001),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13002),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15002),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13003),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15003),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13004),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15004),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13005),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15005),
// Zone: to.Ptr("1"),
// }},
// Port: to.Ptr[int32](6379),
// ProvisioningState: to.Ptr(armredis.ProvisioningStateSucceeded),
// SSLPort: to.Ptr[int32](6380),
// },
// Zones: []*string{
// to.Ptr("1")},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RedisManagementClient } = require("@azure/arm-rediscache");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
*
* @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
* x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateLatestVersion.json
*/
async function redisCacheCreateLatestVersion() {
const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1";
const name = "cache1";
const parameters = {
enableNonSslPort: true,
location: "East US",
minimumTlsVersion: "1.2",
redisConfiguration: { maxmemoryPolicy: "allkeys-lru" },
redisVersion: "Latest",
replicasPerPrimary: 2,
shardCount: 2,
sku: { name: "Premium", capacity: 1, family: "P" },
staticIP: "192.168.0.5",
subnetId:
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new RedisManagementClient(credential, subscriptionId);
const result = await client.redis.beginCreateAndWait(resourceGroupName, name, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Net;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Redis.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Redis;
// Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateLatestVersion.json
// this example is just showing the usage of "Redis_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this RedisResource
RedisCollection collection = resourceGroupResource.GetAllRedis();
// invoke the operation
string name = "cache1";
RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1))
{
Zones = { "1" },
RedisConfiguration = new RedisCommonConfiguration
{
MaxMemoryPolicy = "allkeys-lru",
},
RedisVersion = "Latest",
EnableNonSslPort = true,
ReplicasPerPrimary = 2,
ShardCount = 2,
MinimumTlsVersion = RedisTlsVersion.Tls1_2,
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
StaticIP = IPAddress.Parse("192.168.0.5"),
};
ArmOperation<RedisResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content);
RedisResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
RedisData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "West US",
"zones": [
"1"
],
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0.14",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": false,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "UserDefined",
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"zone": "1",
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"zone": "1",
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "West US",
"zones": [
"1"
],
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0.14",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": false,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "UserDefined",
"redisConfiguration": {
"maxclients": "1000",
"maxmemory-reserved": "50",
"maxmemory-delta": "50"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"zone": "1",
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"zone": "1",
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
RedisCacheCreateNoZonesZonalAllocationPolicy
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/cache1?api-version=2024-11-01
{
"location": "East US",
"properties": {
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": true,
"shardCount": 2,
"replicasPerPrimary": 2,
"zonalAllocationPolicy": "NoZones",
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
"staticIP": "192.168.0.5",
"minimumTlsVersion": "1.2"
}
}
import com.azure.resourcemanager.redis.models.RedisConfiguration;
import com.azure.resourcemanager.redis.models.RedisCreateParameters;
import com.azure.resourcemanager.redis.models.Sku;
import com.azure.resourcemanager.redis.models.SkuFamily;
import com.azure.resourcemanager.redis.models.SkuName;
import com.azure.resourcemanager.redis.models.TlsVersion;
import com.azure.resourcemanager.redis.models.ZonalAllocationPolicy;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Redis Create.
*/
public final class Main {
/*
* x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/
* RedisCacheCreateNoZonesZonalAllocationPolicy.json
*/
/**
* Sample code: RedisCacheCreateNoZonesZonalAllocationPolicy.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
redisCacheCreateNoZonesZonalAllocationPolicy(com.azure.resourcemanager.AzureResourceManager azure) {
azure.redisCaches().manager().serviceClient().getRedis().create("rg1", "cache1", new RedisCreateParameters()
.withLocation("East US")
.withSku(new Sku().withName(SkuName.PREMIUM).withFamily(SkuFamily.P).withCapacity(1))
.withSubnetId(
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1")
.withStaticIp("192.168.0.5")
.withRedisConfiguration(
new RedisConfiguration().withMaxmemoryPolicy("allkeys-lru").withAdditionalProperties(mapOf()))
.withEnableNonSslPort(true).withReplicasPerPrimary(2).withShardCount(2)
.withMinimumTlsVersion(TlsVersion.ONE_TWO).withZonalAllocationPolicy(ZonalAllocationPolicy.NO_ZONES),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.redis import RedisManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redis
# USAGE
python redis_cache_create_no_zones_zonal_allocation_policy.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.redis.begin_create(
resource_group_name="rg1",
name="cache1",
parameters={
"location": "East US",
"properties": {
"enableNonSslPort": True,
"minimumTlsVersion": "1.2",
"redisConfiguration": {"maxmemory-policy": "allkeys-lru"},
"replicasPerPrimary": 2,
"shardCount": 2,
"sku": {"capacity": 1, "family": "P", "name": "Premium"},
"staticIP": "192.168.0.5",
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
"zonalAllocationPolicy": "NoZones",
},
},
).result()
print(response)
# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateNoZonesZonalAllocationPolicy.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armredis_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/45374f48f560b3337ed55735038f1e9bf8cbea65/specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateNoZonesZonalAllocationPolicy.json
func ExampleClient_BeginCreate_redisCacheCreateNoZonesZonalAllocationPolicy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armredis.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreate(ctx, "rg1", "cache1", armredis.CreateParameters{
Location: to.Ptr("East US"),
Properties: &armredis.CreateProperties{
EnableNonSSLPort: to.Ptr(true),
MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
MaxmemoryPolicy: to.Ptr("allkeys-lru"),
},
ReplicasPerPrimary: to.Ptr[int32](2),
ShardCount: to.Ptr[int32](2),
ZonalAllocationPolicy: to.Ptr(armredis.ZonalAllocationPolicyNoZones),
SKU: &armredis.SKU{
Name: to.Ptr(armredis.SKUNamePremium),
Capacity: to.Ptr[int32](1),
Family: to.Ptr(armredis.SKUFamilyP),
},
StaticIP: to.Ptr("192.168.0.5"),
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ResourceInfo = armredis.ResourceInfo{
// Name: to.Ptr("cache1"),
// Type: to.Ptr("Microsoft.Cache/Redis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1"),
// Location: to.Ptr("East US"),
// Tags: map[string]*string{
// },
// Properties: &armredis.Properties{
// EnableNonSSLPort: to.Ptr(true),
// MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
// RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
// Maxclients: to.Ptr("1000"),
// MaxmemoryDelta: to.Ptr("50"),
// MaxmemoryReserved: to.Ptr("50"),
// },
// RedisVersion: to.Ptr("6.0"),
// ReplicasPerMaster: to.Ptr[int32](2),
// ReplicasPerPrimary: to.Ptr[int32](2),
// ShardCount: to.Ptr[int32](2),
// UpdateChannel: to.Ptr(armredis.UpdateChannelStable),
// ZonalAllocationPolicy: to.Ptr(armredis.ZonalAllocationPolicyNoZones),
// SKU: &armredis.SKU{
// Name: to.Ptr(armredis.SKUNamePremium),
// Capacity: to.Ptr[int32](1),
// Family: to.Ptr(armredis.SKUFamilyP),
// },
// AccessKeys: &armredis.AccessKeys{
// PrimaryKey: to.Ptr("<primaryKey>"),
// SecondaryKey: to.Ptr("<secondaryKey>"),
// },
// HostName: to.Ptr("cache1.redis.cache.windows.net"),
// Instances: []*armredis.InstanceDetails{
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13000),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15000),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13001),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15001),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13002),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15002),
// },
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13003),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15003),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13004),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15004),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13005),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15005),
// }},
// Port: to.Ptr[int32](6379),
// ProvisioningState: to.Ptr(armredis.ProvisioningStateSucceeded),
// SSLPort: to.Ptr[int32](6380),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RedisManagementClient } = require("@azure/arm-rediscache");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
*
* @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
* x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateNoZonesZonalAllocationPolicy.json
*/
async function redisCacheCreateNoZonesZonalAllocationPolicy() {
const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1";
const name = "cache1";
const parameters = {
enableNonSslPort: true,
location: "East US",
minimumTlsVersion: "1.2",
redisConfiguration: { maxmemoryPolicy: "allkeys-lru" },
replicasPerPrimary: 2,
shardCount: 2,
sku: { name: "Premium", capacity: 1, family: "P" },
staticIP: "192.168.0.5",
subnetId:
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
zonalAllocationPolicy: "NoZones",
};
const credential = new DefaultAzureCredential();
const client = new RedisManagementClient(credential, subscriptionId);
const result = await client.redis.beginCreateAndWait(resourceGroupName, name, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Net;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Redis.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Redis;
// Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateNoZonesZonalAllocationPolicy.json
// this example is just showing the usage of "Redis_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this RedisResource
RedisCollection collection = resourceGroupResource.GetAllRedis();
// invoke the operation
string name = "cache1";
RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1))
{
RedisConfiguration = new RedisCommonConfiguration
{
MaxMemoryPolicy = "allkeys-lru",
},
EnableNonSslPort = true,
ReplicasPerPrimary = 2,
ShardCount = 2,
MinimumTlsVersion = RedisTlsVersion.Tls1_2,
ZonalAllocationPolicy = ZonalAllocationPolicy.NoZones,
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
StaticIP = IPAddress.Parse("192.168.0.5"),
};
ArmOperation<RedisResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content);
RedisResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
RedisData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "East US",
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"shardCount": 2,
"enableNonSslPort": true,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "NoZones",
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "East US",
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"shardCount": 2,
"enableNonSslPort": true,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "NoZones",
"redisConfiguration": {
"maxclients": "1000",
"maxmemory-reserved": "50",
"maxmemory-delta": "50"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
RedisCacheCreateUserDefinedZonalAllocationPolicy
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/cache1?api-version=2024-11-01
{
"location": "East US",
"zones": [
"1"
],
"properties": {
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"redisVersion": "Latest",
"enableNonSslPort": true,
"shardCount": 2,
"replicasPerPrimary": 2,
"zonalAllocationPolicy": "UserDefined",
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
"staticIP": "192.168.0.5",
"minimumTlsVersion": "1.2"
}
}
import com.azure.resourcemanager.redis.models.RedisConfiguration;
import com.azure.resourcemanager.redis.models.RedisCreateParameters;
import com.azure.resourcemanager.redis.models.Sku;
import com.azure.resourcemanager.redis.models.SkuFamily;
import com.azure.resourcemanager.redis.models.SkuName;
import com.azure.resourcemanager.redis.models.TlsVersion;
import com.azure.resourcemanager.redis.models.ZonalAllocationPolicy;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Redis Create.
*/
public final class Main {
/*
* x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/
* RedisCacheCreateUserDefinedZonalAllocationPolicy.json
*/
/**
* Sample code: RedisCacheCreateUserDefinedZonalAllocationPolicy.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
redisCacheCreateUserDefinedZonalAllocationPolicy(com.azure.resourcemanager.AzureResourceManager azure) {
azure.redisCaches().manager().serviceClient().getRedis().create("rg1", "cache1", new RedisCreateParameters()
.withZones(Arrays.asList("1")).withLocation("East US")
.withSku(new Sku().withName(SkuName.PREMIUM).withFamily(SkuFamily.P).withCapacity(1))
.withSubnetId(
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1")
.withStaticIp("192.168.0.5")
.withRedisConfiguration(
new RedisConfiguration().withMaxmemoryPolicy("allkeys-lru").withAdditionalProperties(mapOf()))
.withRedisVersion("Latest").withEnableNonSslPort(true).withReplicasPerPrimary(2).withShardCount(2)
.withMinimumTlsVersion(TlsVersion.ONE_TWO).withZonalAllocationPolicy(ZonalAllocationPolicy.USER_DEFINED),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.redis import RedisManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-redis
# USAGE
python redis_cache_create_user_defined_zonal_allocation_policy.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RedisManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.redis.begin_create(
resource_group_name="rg1",
name="cache1",
parameters={
"location": "East US",
"properties": {
"enableNonSslPort": True,
"minimumTlsVersion": "1.2",
"redisConfiguration": {"maxmemory-policy": "allkeys-lru"},
"redisVersion": "Latest",
"replicasPerPrimary": 2,
"shardCount": 2,
"sku": {"capacity": 1, "family": "P", "name": "Premium"},
"staticIP": "192.168.0.5",
"subnetId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
"zonalAllocationPolicy": "UserDefined",
},
"zones": ["1"],
},
).result()
print(response)
# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateUserDefinedZonalAllocationPolicy.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armredis_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/45374f48f560b3337ed55735038f1e9bf8cbea65/specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateUserDefinedZonalAllocationPolicy.json
func ExampleClient_BeginCreate_redisCacheCreateUserDefinedZonalAllocationPolicy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armredis.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClient().BeginCreate(ctx, "rg1", "cache1", armredis.CreateParameters{
Location: to.Ptr("East US"),
Properties: &armredis.CreateProperties{
EnableNonSSLPort: to.Ptr(true),
MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
MaxmemoryPolicy: to.Ptr("allkeys-lru"),
},
RedisVersion: to.Ptr("Latest"),
ReplicasPerPrimary: to.Ptr[int32](2),
ShardCount: to.Ptr[int32](2),
ZonalAllocationPolicy: to.Ptr(armredis.ZonalAllocationPolicyUserDefined),
SKU: &armredis.SKU{
Name: to.Ptr(armredis.SKUNamePremium),
Capacity: to.Ptr[int32](1),
Family: to.Ptr(armredis.SKUFamilyP),
},
StaticIP: to.Ptr("192.168.0.5"),
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
},
Zones: []*string{
to.Ptr("1")},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ResourceInfo = armredis.ResourceInfo{
// Name: to.Ptr("cache1"),
// Type: to.Ptr("Microsoft.Cache/Redis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1"),
// Location: to.Ptr("East US"),
// Tags: map[string]*string{
// },
// Properties: &armredis.Properties{
// EnableNonSSLPort: to.Ptr(false),
// MinimumTLSVersion: to.Ptr(armredis.TLSVersionOne2),
// RedisConfiguration: &armredis.CommonPropertiesRedisConfiguration{
// Maxclients: to.Ptr("1000"),
// MaxmemoryDelta: to.Ptr("50"),
// MaxmemoryReserved: to.Ptr("50"),
// },
// RedisVersion: to.Ptr("6.0.14"),
// ReplicasPerMaster: to.Ptr[int32](2),
// ReplicasPerPrimary: to.Ptr[int32](2),
// UpdateChannel: to.Ptr(armredis.UpdateChannelStable),
// ZonalAllocationPolicy: to.Ptr(armredis.ZonalAllocationPolicyUserDefined),
// SKU: &armredis.SKU{
// Name: to.Ptr(armredis.SKUNamePremium),
// Capacity: to.Ptr[int32](1),
// Family: to.Ptr(armredis.SKUFamilyP),
// },
// AccessKeys: &armredis.AccessKeys{
// PrimaryKey: to.Ptr("<primaryKey>"),
// SecondaryKey: to.Ptr("<secondaryKey>"),
// },
// HostName: to.Ptr("cache1.redis.cache.windows.net"),
// Instances: []*armredis.InstanceDetails{
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13000),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15000),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13001),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15001),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13002),
// ShardID: to.Ptr[int32](0),
// SSLPort: to.Ptr[int32](15002),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(true),
// IsPrimary: to.Ptr(true),
// NonSSLPort: to.Ptr[int32](13003),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15003),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13004),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15004),
// Zone: to.Ptr("1"),
// },
// {
// IsMaster: to.Ptr(false),
// IsPrimary: to.Ptr(false),
// NonSSLPort: to.Ptr[int32](13005),
// ShardID: to.Ptr[int32](1),
// SSLPort: to.Ptr[int32](15005),
// Zone: to.Ptr("1"),
// }},
// Port: to.Ptr[int32](6379),
// ProvisioningState: to.Ptr(armredis.ProvisioningStateSucceeded),
// SSLPort: to.Ptr[int32](6380),
// },
// Zones: []*string{
// to.Ptr("1")},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RedisManagementClient } = require("@azure/arm-rediscache");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
*
* @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
* x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateUserDefinedZonalAllocationPolicy.json
*/
async function redisCacheCreateUserDefinedZonalAllocationPolicy() {
const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1";
const name = "cache1";
const parameters = {
enableNonSslPort: true,
location: "East US",
minimumTlsVersion: "1.2",
redisConfiguration: { maxmemoryPolicy: "allkeys-lru" },
redisVersion: "Latest",
replicasPerPrimary: 2,
shardCount: 2,
sku: { name: "Premium", capacity: 1, family: "P" },
staticIP: "192.168.0.5",
subnetId:
"/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1",
zonalAllocationPolicy: "UserDefined",
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new RedisManagementClient(credential, subscriptionId);
const result = await client.redis.beginCreateAndWait(resourceGroupName, name, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Net;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Redis.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Redis;
// Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateUserDefinedZonalAllocationPolicy.json
// this example is just showing the usage of "Redis_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this RedisResource
RedisCollection collection = resourceGroupResource.GetAllRedis();
// invoke the operation
string name = "cache1";
RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1))
{
Zones = { "1" },
RedisConfiguration = new RedisCommonConfiguration
{
MaxMemoryPolicy = "allkeys-lru",
},
RedisVersion = "Latest",
EnableNonSslPort = true,
ReplicasPerPrimary = 2,
ShardCount = 2,
MinimumTlsVersion = RedisTlsVersion.Tls1_2,
ZonalAllocationPolicy = ZonalAllocationPolicy.UserDefined,
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"),
StaticIP = IPAddress.Parse("192.168.0.5"),
};
ArmOperation<RedisResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content);
RedisResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
RedisData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exemple de réponse
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "East US",
"zones": [
"1"
],
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0.14",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": false,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "UserDefined",
"redisConfiguration": {
"maxmemory-policy": "allkeys-lru"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"zone": "1",
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"zone": "1",
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache1",
"location": "East US",
"zones": [
"1"
],
"name": "cache1",
"type": "Microsoft.Cache/Redis",
"tags": {},
"properties": {
"accessKeys": {
"primaryKey": "<primaryKey>",
"secondaryKey": "<secondaryKey>"
},
"provisioningState": "Succeeded",
"redisVersion": "6.0.14",
"sku": {
"name": "Premium",
"family": "P",
"capacity": 1
},
"enableNonSslPort": false,
"replicasPerMaster": 2,
"replicasPerPrimary": 2,
"updateChannel": "Stable",
"zonalAllocationPolicy": "UserDefined",
"redisConfiguration": {
"maxclients": "1000",
"maxmemory-reserved": "50",
"maxmemory-delta": "50"
},
"hostName": "cache1.redis.cache.windows.net",
"port": 6379,
"sslPort": 6380,
"minimumTlsVersion": "1.2",
"instances": [
{
"sslPort": 15000,
"nonSslPort": 13000,
"zone": "1",
"shardId": 0,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15001,
"nonSslPort": 13001,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15002,
"nonSslPort": 13002,
"zone": "1",
"shardId": 0,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15003,
"nonSslPort": 13003,
"zone": "1",
"shardId": 1,
"isMaster": true,
"isPrimary": true
},
{
"sslPort": 15004,
"nonSslPort": 13004,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
},
{
"sslPort": 15005,
"nonSslPort": 13005,
"zone": "1",
"shardId": 1,
"isMaster": false,
"isPrimary": false
}
]
}
}
Définitions
Nom |
Description |
ErrorAdditionalInfo
|
Informations supplémentaires sur l’erreur de gestion des ressources.
|
ErrorDetail
|
Détail de l’erreur.
|
ErrorResponse
|
Réponse d’erreur
|
ManagedServiceIdentity
|
Identité de service managée (identités affectées par le système et/ou identités affectées par l’utilisateur)
|
ManagedServiceIdentityType
|
Type d’identité de service managé (où les types SystemAssigned et UserAssigned sont autorisés).
|
PrivateEndpoint
|
Ressource de point de terminaison privé.
|
PrivateEndpointConnection
|
Ressource de connexion de point de terminaison privé.
|
PrivateEndpointConnectionProvisioningState
|
État d’approvisionnement actuel.
|
PrivateEndpointServiceConnectionStatus
|
État de la connexion de point de terminaison privé.
|
PrivateLinkServiceConnectionState
|
Collection d’informations sur l’état de la connexion entre le consommateur de services et le fournisseur.
|
ProvisioningState
|
État d’approvisionnement de l’instance Redis.
|
PublicNetworkAccess
|
Indique si l’accès au point de terminaison public est autorisé pour ce cache. La valeur est facultative, mais si elle est passée, doit être « Activé » ou « Désactivé ». Si « Désactivé », les points de terminaison privés sont la méthode d’accès exclusif. La valeur par défaut est « Enabled »
|
RedisAccessKeys
|
Clés d’accès du cache Redis.
|
RedisConfiguration
|
Tous les paramètres Redis. Peu de clés possibles : rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-string-1, etc.
|
RedisCreateParameters
|
Paramètres fournis à l’opération Créer Redis.
|
RedisInstanceDetails
|
Détails de l’instance unique de redis.
|
RedisLinkedServer
|
ID de serveur lié
|
RedisResource
|
Élément Redis unique dans l’opération Liste ou Obtenir.
|
Sku
|
Paramètres de référence SKU fournis pour l’opération de création de Redis.
|
SkuFamily
|
Famille de références SKU à utiliser. Valeurs valides : (C, P). (C = De base/Standard, P = Premium).
|
SkuName
|
Type de cache Redis à déployer. Valeurs valides : (De base, Standard, Premium)
|
TlsVersion
|
Facultatif : nécessite que les clients utilisent une version TLS spécifiée (ou une version ultérieure) pour se connecter (par exemple, « 1.0 », « 1.1 », « 1.2 »)
|
UpdateChannel
|
Facultatif : spécifie le canal de mise à jour pour les mises à jour mensuelles de Redis que votre cache Redis recevra. Les caches utilisant le canal de mise à jour « Préversion » obtiennent les dernières mises à jour Redis au moins 4 semaines à l’avance sur les caches de canal « Stable ». La valeur par défaut est « Stable ».
|
UserAssignedIdentity
|
Propriétés d’identité attribuées par l’utilisateur
|
ZonalAllocationPolicy
|
Facultatif : spécifie la façon dont les zones de disponibilité sont allouées au cache Redis. « Automatique » active la redondance de zone et Azure sélectionne automatiquement les zones en fonction de la disponibilité et de la capacité régionales. « UserDefined » sélectionne les zones de disponibilité transmises par vous à l’aide du paramètre « zones ». 'NoZones' produit un cache non zonal. Si « zonalAllocationPolicy » n’est pas passé, il est défini sur « UserDefined » lorsque les zones sont passées ; sinon, elle est définie sur « Automatique » dans les régions où les zones sont prises en charge et « NoZones » dans les régions où les zones ne sont pas prises en charge.
|
ErrorAdditionalInfo
Object
Informations supplémentaires sur l’erreur de gestion des ressources.
Nom |
Type |
Description |
info
|
object
|
Informations supplémentaires.
|
type
|
string
|
Type d’informations supplémentaire.
|
ErrorDetail
Object
Détail de l’erreur.
Nom |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Informations supplémentaires sur l’erreur.
|
code
|
string
|
Code d’erreur.
|
details
|
ErrorDetail[]
|
Détails de l’erreur.
|
message
|
string
|
Message d’erreur.
|
target
|
string
|
Cible d’erreur.
|
ErrorResponse
Object
Réponse d’erreur
ManagedServiceIdentity
Object
Identité de service managée (identités affectées par le système et/ou identités affectées par l’utilisateur)
Nom |
Type |
Description |
principalId
|
string
(uuid)
|
ID du principal de service de l’identité affectée par le système. Cette propriété est fournie uniquement pour une identité affectée par le système.
|
tenantId
|
string
(uuid)
|
ID de locataire de l’identité affectée par le système. Cette propriété est fournie uniquement pour une identité affectée par le système.
|
type
|
ManagedServiceIdentityType
|
Type d’identité de service managé (où les types SystemAssigned et UserAssigned sont autorisés).
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
identités User-Assigned
Ensemble d’identités affectées par l’utilisateur associées à la ressource. Les clés de dictionnaire userAssignedIdentities seront des ID de ressource ARM sous la forme : « /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. Les valeurs de dictionnaire peuvent être des objets vides ({}) dans les requêtes.
|
ManagedServiceIdentityType
Énumération
Type d’identité de service managé (où les types SystemAssigned et UserAssigned sont autorisés).
Valeur |
Description |
None
|
|
SystemAssigned
|
|
SystemAssigned, UserAssigned
|
|
UserAssigned
|
|
PrivateEndpoint
Object
Ressource de point de terminaison privé.
Nom |
Type |
Description |
id
|
string
|
Identificateur ARM pour le point de terminaison privé
|
PrivateEndpointConnection
Object
Ressource de connexion de point de terminaison privé.
Nom |
Type |
Description |
id
|
string
|
ID de ressource complet pour la ressource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
Nom de la ressource
|
properties.privateEndpoint
|
PrivateEndpoint
|
Ressource du point de terminaison privé.
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
Collection d’informations sur l’état de la connexion entre le consommateur de services et le fournisseur.
|
properties.provisioningState
|
PrivateEndpointConnectionProvisioningState
|
État d’approvisionnement de la ressource de connexion de point de terminaison privé.
|
type
|
string
|
Type de la ressource. Par exemple, « Microsoft.Compute/virtualMachines » ou « Microsoft.Storage/storageAccounts »
|
PrivateEndpointConnectionProvisioningState
Énumération
État d’approvisionnement actuel.
Valeur |
Description |
Creating
|
|
Deleting
|
|
Failed
|
|
Succeeded
|
|
PrivateEndpointServiceConnectionStatus
Énumération
État de la connexion de point de terminaison privé.
Valeur |
Description |
Approved
|
|
Pending
|
|
Rejected
|
|
PrivateLinkServiceConnectionState
Object
Collection d’informations sur l’état de la connexion entre le consommateur de services et le fournisseur.
Nom |
Type |
Description |
actionsRequired
|
string
|
Message indiquant si les modifications apportées au fournisseur de services nécessitent des mises à jour sur le consommateur.
|
description
|
string
|
Raison de l’approbation/rejet de la connexion.
|
status
|
PrivateEndpointServiceConnectionStatus
|
Indique si la connexion a été approuvée/rejetée/supprimée par le propriétaire du service.
|
ProvisioningState
Énumération
État d’approvisionnement de l’instance Redis.
Valeur |
Description |
ConfiguringAAD
|
|
Creating
|
|
Deleting
|
|
Disabled
|
|
Failed
|
|
Linking
|
|
Provisioning
|
|
RecoveringScaleFailure
|
|
Scaling
|
|
Succeeded
|
|
Unlinking
|
|
Unprovisioning
|
|
Updating
|
|
PublicNetworkAccess
Énumération
Indique si l’accès au point de terminaison public est autorisé pour ce cache. La valeur est facultative, mais si elle est passée, doit être « Activé » ou « Désactivé ». Si « Désactivé », les points de terminaison privés sont la méthode d’accès exclusif. La valeur par défaut est « Enabled »
Valeur |
Description |
Disabled
|
|
Enabled
|
|
RedisAccessKeys
Object
Clés d’accès du cache Redis.
Nom |
Type |
Description |
primaryKey
|
string
|
Clé primaire actuelle que les clients peuvent utiliser pour s’authentifier auprès du cache Redis.
|
secondaryKey
|
string
|
Clé secondaire actuelle que les clients peuvent utiliser pour s’authentifier auprès du cache Redis.
|
RedisConfiguration
Object
Tous les paramètres Redis. Peu de clés possibles : rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-string-1, etc.
Nom |
Type |
Description |
aad-enabled
|
string
|
Spécifie si l’authentification basée sur AAD a été activée ou désactivée pour le cache
|
aof-backup-enabled
|
string
|
Spécifie si la sauvegarde aof est activée
|
aof-storage-connection-string-0
|
string
|
Première chaîne de connexion de compte de stockage
|
aof-storage-connection-string-1
|
string
|
Deuxième chaîne de connexion de compte de stockage
|
authnotrequired
|
string
|
Spécifie si l’authentification est désactivée. La définition de cette propriété est fortement déconseillée du point de vue de la sécurité.
|
maxclients
|
string
|
Configuration maximale des clients
|
maxfragmentationmemory-reserved
|
string
|
Valeur en mégaoctets réservés pour la fragmentation par partition
|
maxmemory-delta
|
string
|
Valeur en mégaoctets réservés pour l’utilisation non du cache par partition, par exemple le basculement.
|
maxmemory-policy
|
string
|
La stratégie d’éviction utilisée lorsque vos données ne correspondent pas à sa limite de mémoire.
|
maxmemory-reserved
|
string
|
Valeur en mégaoctets réservés pour l’utilisation non du cache par partition, par exemple le basculement.
|
notify-keyspace-events
|
string
|
Événements d’espace de clés qui doivent être surveillés.
|
preferred-data-archive-auth-method
|
string
|
Méthode d’authentification préférée pour communiquer avec le compte de stockage utilisé pour l’archivage des données, spécifier SAS ou ManagedIdentity, la valeur par défaut est SAS
|
preferred-data-persistence-auth-method
|
string
|
Méthode d’authentification préférée pour communiquer avec le compte de stockage utilisé pour la persistance des données, spécifier saS ou ManagedIdentity, la valeur par défaut est SAS
|
rdb-backup-enabled
|
string
|
Spécifie si la sauvegarde rdb est activée
|
rdb-backup-frequency
|
string
|
Spécifie la fréquence de création d’une sauvegarde rdb en minutes. Valeurs valides : (15, 30, 60, 360, 720, 1440)
|
rdb-backup-max-snapshot-count
|
string
|
Spécifie le nombre maximal d’instantanés pour la sauvegarde rdb
|
rdb-storage-connection-string
|
string
|
Chaîne de connexion de compte de stockage pour le stockage du fichier rdb
|
storage-subscription-id
|
string
|
SubscriptionId du compte de stockage pour la persistance (aof/rdb) à l’aide de ManagedIdentity.
|
zonal-configuration
|
string
|
Configuration zonale
|
RedisCreateParameters
Object
Paramètres fournis à l’opération Créer Redis.
Nom |
Type |
Valeur par défaut |
Description |
identity
|
ManagedServiceIdentity
|
|
Identité de la ressource.
|
location
|
string
|
|
Emplacement géographique où réside la ressource
|
properties.disableAccessKeyAuthentication
|
boolean
|
False
|
L’authentification auprès de Redis par le biais de clés d’accès est désactivée lorsqu’elle est définie sur true. La valeur par défaut est false.
|
properties.enableNonSslPort
|
boolean
|
False
|
Spécifie si le port du serveur Redis non ssl (6379) est activé.
|
properties.minimumTlsVersion
|
TlsVersion
|
|
Facultatif : nécessite que les clients utilisent une version TLS spécifiée (ou une version ultérieure) pour se connecter (par exemple, « 1.0 », « 1.1 », « 1.2 »)
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
Enabled
|
Indique si l’accès au point de terminaison public est autorisé pour ce cache. La valeur est facultative, mais si elle est passée, doit être « Activé » ou « Désactivé ». Si « Désactivé », les points de terminaison privés sont la méthode d’accès exclusif. La valeur par défaut est « Enabled »
|
properties.redisConfiguration
|
RedisConfiguration
|
|
Tous les paramètres Redis. Peu de clés possibles : rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-string-1, etc.
|
properties.redisVersion
|
string
|
|
Version de Redis. Il doit s’agir de la forme « major[.minor] » (seul « major » est requis) ou de la valeur « latest » qui fait référence à la dernière version stable de Redis disponible. Versions prises en charge : 4.0, 6.0 (dernière version). La valeur par défaut est « latest ».
|
properties.replicasPerMaster
|
integer
(int32)
|
|
Nombre de réplicas à créer par réplica principal.
|
properties.replicasPerPrimary
|
integer
(int32)
|
|
Nombre de réplicas à créer par réplica principal.
|
properties.shardCount
|
integer
(int32)
|
|
Nombre de partitions à créer sur un cache de cluster Premium.
|
properties.sku
|
Sku
|
|
Référence SKU du cache Redis à déployer.
|
properties.staticIP
|
string
pattern: ^\d+\.\d+\.\d+\.\d+$
|
|
Adresse IP statique. Si vous le souhaitez, vous pouvez spécifier le déploiement d’un cache Redis à l’intérieur d’un réseau virtuel Azure existant ; automatiquement affecté par défaut.
|
properties.subnetId
|
string
pattern: ^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$
|
|
ID de ressource complet d’un sous-réseau dans un réseau virtuel dans lequel déployer le cache Redis. Exemple de format : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft. {Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1
|
properties.tenantSettings
|
object
|
|
Dictionnaire des paramètres de locataire
|
properties.updateChannel
|
UpdateChannel
|
|
Facultatif : spécifie le canal de mise à jour pour les mises à jour mensuelles de Redis que votre cache Redis recevra. Les caches utilisant le canal de mise à jour « Préversion » obtiennent les dernières mises à jour Redis au moins 4 semaines à l’avance sur les caches de canal « Stable ». La valeur par défaut est « Stable ».
|
properties.zonalAllocationPolicy
|
ZonalAllocationPolicy
|
|
Facultatif : spécifie la façon dont les zones de disponibilité sont allouées au cache Redis. « Automatique » active la redondance de zone et Azure sélectionne automatiquement les zones en fonction de la disponibilité et de la capacité régionales. « UserDefined » sélectionne les zones de disponibilité transmises par vous à l’aide du paramètre « zones ». 'NoZones' produit un cache non zonal. Si « zonalAllocationPolicy » n’est pas passé, il est défini sur « UserDefined » lorsque les zones sont passées ; sinon, elle est définie sur « Automatique » dans les régions où les zones sont prises en charge et « NoZones » dans les régions où les zones ne sont pas prises en charge.
|
tags
|
object
|
|
Balises de ressource.
|
zones
|
string[]
|
|
Liste des zones de disponibilité indiquant à partir de laquelle la ressource doit provenir.
|
RedisInstanceDetails
Object
Détails de l’instance unique de redis.
Nom |
Type |
Description |
isMaster
|
boolean
|
Spécifie si l’instance est un nœud principal.
|
isPrimary
|
boolean
|
Spécifie si l’instance est un nœud principal.
|
nonSslPort
|
integer
(int32)
|
Si enableNonSslPort a la valeur true, fournit le port Non-SSL de l’instance Redis.
|
shardId
|
integer
(int32)
|
Si le clustering est activé, l’ID de partition de l’instance Redis
|
sslPort
|
integer
(int32)
|
Port SSL de l’instance Redis.
|
zone
|
string
|
Si le cache utilise des zones de disponibilité, spécifie la zone de disponibilité où se trouve cette instance.
|
RedisLinkedServer
Object
ID de serveur lié
Nom |
Type |
Description |
id
|
string
|
ID de serveur lié.
|
RedisResource
Object
Élément Redis unique dans l’opération Liste ou Obtenir.
Nom |
Type |
Valeur par défaut |
Description |
disableAccessKeyAuthentication
|
boolean
|
False
|
L’authentification auprès de Redis par le biais de clés d’accès est désactivée lorsqu’elle est définie sur true. La valeur par défaut est false.
|
enableNonSslPort
|
boolean
|
False
|
Spécifie si le port du serveur Redis non ssl (6379) est activé.
|
id
|
string
|
|
ID de ressource complet pour la ressource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
ManagedServiceIdentity
|
|
Identité de la ressource.
|
location
|
string
|
|
Emplacement géographique où réside la ressource
|
minimumTlsVersion
|
TlsVersion
|
|
Facultatif : nécessite que les clients utilisent une version TLS spécifiée (ou une version ultérieure) pour se connecter (par exemple, « 1.0 », « 1.1 », « 1.2 »)
|
name
|
string
|
|
Nom de la ressource
|
properties.accessKeys
|
RedisAccessKeys
|
|
Clés du cache Redis - non définie si cet objet n’est pas la réponse au cache Redis Créer ou mettre à jour
|
properties.hostName
|
string
|
|
Nom d’hôte Redis.
|
properties.instances
|
RedisInstanceDetails[]
|
|
Liste des instances Redis associées au cache
|
properties.linkedServers
|
RedisLinkedServer[]
|
|
Liste des serveurs liés associés au cache
|
properties.port
|
integer
(int32)
|
|
Port Redis non SSL.
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
|
Liste des connexions de point de terminaison privé associées au cache redis spécifié
|
properties.provisioningState
|
ProvisioningState
|
|
État d’approvisionnement de l’instance Redis.
|
properties.sku
|
Sku
|
|
Référence SKU du cache Redis à déployer.
|
properties.sslPort
|
integer
(int32)
|
|
Port SSL Redis.
|
properties.staticIP
|
string
pattern: ^\d+\.\d+\.\d+\.\d+$
|
|
Adresse IP statique. Si vous le souhaitez, vous pouvez spécifier le déploiement d’un cache Redis à l’intérieur d’un réseau virtuel Azure existant ; automatiquement affecté par défaut.
|
properties.subnetId
|
string
pattern: ^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$
|
|
ID de ressource complet d’un sous-réseau dans un réseau virtuel dans lequel déployer le cache Redis. Exemple de format : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft. {Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1
|
publicNetworkAccess
|
PublicNetworkAccess
|
Enabled
|
Indique si l’accès au point de terminaison public est autorisé pour ce cache. La valeur est facultative, mais si elle est passée, doit être « Activé » ou « Désactivé ». Si « Désactivé », les points de terminaison privés sont la méthode d’accès exclusif. La valeur par défaut est « Enabled »
|
redisConfiguration
|
RedisConfiguration
|
|
Tous les paramètres Redis. Peu de clés possibles : rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-string-1, etc.
|
redisVersion
|
string
|
|
Version de Redis. Il doit s’agir de la forme « major[.minor] » (seul « major » est requis) ou de la valeur « latest » qui fait référence à la dernière version stable de Redis disponible. Versions prises en charge : 4.0, 6.0 (dernière version). La valeur par défaut est « latest ».
|
replicasPerMaster
|
integer
(int32)
|
|
Nombre de réplicas à créer par réplica principal.
|
replicasPerPrimary
|
integer
(int32)
|
|
Nombre de réplicas à créer par réplica principal.
|
shardCount
|
integer
(int32)
|
|
Nombre de partitions à créer sur un cache de cluster Premium.
|
tags
|
object
|
|
Balises de ressource.
|
tenantSettings
|
object
|
|
Dictionnaire des paramètres de locataire
|
type
|
string
|
|
Type de la ressource. Par exemple, « Microsoft.Compute/virtualMachines » ou « Microsoft.Storage/storageAccounts »
|
updateChannel
|
UpdateChannel
|
|
Facultatif : spécifie le canal de mise à jour pour les mises à jour mensuelles de Redis que votre cache Redis recevra. Les caches utilisant le canal de mise à jour « Préversion » obtiennent les dernières mises à jour Redis au moins 4 semaines à l’avance sur les caches de canal « Stable ». La valeur par défaut est « Stable ».
|
zonalAllocationPolicy
|
ZonalAllocationPolicy
|
|
Facultatif : spécifie la façon dont les zones de disponibilité sont allouées au cache Redis. « Automatique » active la redondance de zone et Azure sélectionne automatiquement les zones en fonction de la disponibilité et de la capacité régionales. « UserDefined » sélectionne les zones de disponibilité transmises par vous à l’aide du paramètre « zones ». 'NoZones' produit un cache non zonal. Si « zonalAllocationPolicy » n’est pas passé, il est défini sur « UserDefined » lorsque les zones sont passées ; sinon, elle est définie sur « Automatique » dans les régions où les zones sont prises en charge et « NoZones » dans les régions où les zones ne sont pas prises en charge.
|
zones
|
string[]
|
|
Liste des zones de disponibilité indiquant à partir de laquelle la ressource doit provenir.
|
Sku
Object
Paramètres de référence SKU fournis pour l’opération de création de Redis.
Nom |
Type |
Description |
capacity
|
integer
(int32)
|
Taille du cache Redis à déployer. Valeurs valides : pour la famille C (De base/Standard) (0, 1, 2, 3, 4, 5, 6), pour la famille P (Premium) (1, 2, 3, 4).
|
family
|
SkuFamily
|
Famille de références SKU à utiliser. Valeurs valides : (C, P). (C = De base/Standard, P = Premium).
|
name
|
SkuName
|
Type de cache Redis à déployer. Valeurs valides : (De base, Standard, Premium)
|
SkuFamily
Énumération
Famille de références SKU à utiliser. Valeurs valides : (C, P). (C = De base/Standard, P = Premium).
SkuName
Énumération
Type de cache Redis à déployer. Valeurs valides : (De base, Standard, Premium)
Valeur |
Description |
Basic
|
|
Premium
|
|
Standard
|
|
TlsVersion
Énumération
Facultatif : nécessite que les clients utilisent une version TLS spécifiée (ou une version ultérieure) pour se connecter (par exemple, « 1.0 », « 1.1 », « 1.2 »)
Valeur |
Description |
1.0
|
|
1.1
|
|
1.2
|
|
UpdateChannel
Énumération
Facultatif : spécifie le canal de mise à jour pour les mises à jour mensuelles de Redis que votre cache Redis recevra. Les caches utilisant le canal de mise à jour « Préversion » obtiennent les dernières mises à jour Redis au moins 4 semaines à l’avance sur les caches de canal « Stable ». La valeur par défaut est « Stable ».
Valeur |
Description |
Preview
|
|
Stable
|
|
UserAssignedIdentity
Object
Propriétés d’identité attribuées par l’utilisateur
Nom |
Type |
Description |
clientId
|
string
(uuid)
|
ID client de l’identité affectée.
|
principalId
|
string
(uuid)
|
ID principal de l’identité affectée.
|
ZonalAllocationPolicy
Énumération
Facultatif : spécifie la façon dont les zones de disponibilité sont allouées au cache Redis. « Automatique » active la redondance de zone et Azure sélectionne automatiquement les zones en fonction de la disponibilité et de la capacité régionales. « UserDefined » sélectionne les zones de disponibilité transmises par vous à l’aide du paramètre « zones ». 'NoZones' produit un cache non zonal. Si « zonalAllocationPolicy » n’est pas passé, il est défini sur « UserDefined » lorsque les zones sont passées ; sinon, elle est définie sur « Automatique » dans les régions où les zones sont prises en charge et « NoZones » dans les régions où les zones ne sont pas prises en charge.
Valeur |
Description |
Automatic
|
|
NoZones
|
|
UserDefined
|
|