PowerShell ile Azure Redis Cache Yönetimi

Azure Cache for Redis, uygulamalarınıza yüksek performanslı önbellekleme katmanı ekler. PowerShell ile Redis instance’larını oluşturabilir, izleyebilir ve yapılandırabilirsiniz.

Redis Cache Oluşturmak

PowerShell

$rg        = "newrg-"
$cacheName = "onurtestrediscache"
$location  = "eastus"
 
New-AzRedisCache -ResourceGroupName $rg -Name $cacheName `
    -Location $location -Size C1 -Sku Standard
 
$redis = Get-AzRedisCache -ResourceGroupName $rg -Name $cacheName
Write-Host "Redis Endpoint: $($redis.HostName):$($redis.SslPort)"
 

Connection string listelemek

PowerShell

$keys = Get-AzRedisCacheKey -ResourceGroupName $rg -Name $cacheName
Write-Host "Primary Key: $($keys.PrimaryKey.Substring(0,20))..."
 
$connStr = "$cacheName.redis.cache.windows.net:6380,password=$($keys.PrimaryKey),ssl=True,abortConnect=False"
Write-Host "Connection string ready."