Skip to content

Commit 8809276

Browse files
authored
Merge pull request Azure#10510 from Azure/redis_fix_issues_9601_9923
Support MinimumTlsVersion property for Redis Cache cmdlets
2 parents e735537 + ffd0eb7 commit 8809276

20 files changed

+20184
-14064
lines changed

src/RedisCache/RedisCache.Test/RedisCache.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.Insights" Version="0.16.0-preview" />
15-
<PackageReference Include="Microsoft.Azure.Management.Redis" Version="4.4.1" />
15+
<PackageReference Include="Microsoft.Azure.Management.Redis" Version="5.0.0" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/RedisCache/RedisCache.Test/ScenarioTests/RedisCacheTests.ps1

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function Test-RedisCache
77
# Setup
88
$resourceGroupName = "PowerShellTest-1"
99
$cacheName = "redisteam001"
10-
$location = "West US"
10+
$location = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "West US"
1111

1212
# Create resource group
1313
New-AzResourceGroup -Name $resourceGroupName -Location $location
@@ -44,14 +44,15 @@ function Test-RedisCache
4444
}
4545

4646
# Updating Cache
47-
$cacheUpdated = Set-AzRedisCache -Name $cacheName -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"} -EnableNonSslPort $true
47+
$cacheUpdated = Set-AzRedisCache -Name $cacheName -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"} -EnableNonSslPort $true -MinimumTlsVersion 1.2
4848

4949
Assert-AreEqual $cacheName $cacheUpdated.Name
5050
Assert-AreEqual 6379 $cacheUpdated.Port
5151
Assert-AreEqual 6380 $cacheUpdated.SslPort
5252
Assert-AreEqual "succeeded" $cacheUpdated.ProvisioningState
5353
Assert-AreEqual "allkeys-lru" $cacheUpdated.RedisConfiguration.Item("maxmemory-policy")
5454
Assert-True { $cacheUpdated.EnableNonSslPort }
55+
Assert-AreEqual "1.2" $cacheUpdated.MinimumTlsVersion
5556

5657
Assert-NotNull $cacheUpdated.PrimaryKey "PrimaryKey do not exists"
5758
Assert-NotNull $cacheUpdated.SecondaryKey "SecondaryKey do not exists"
@@ -117,7 +118,7 @@ function Test-SetNonExistingRedisCacheTest
117118
# Setup
118119
$resourceGroupName = "PowerShellTestNonExisting"
119120
$cacheName = "nonexistingrediscache"
120-
$location = "West US"
121+
$location = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "West US"
121122

122123
# Creating Cache
123124
Assert-Throws {Set-AzRedisCache -ResourceGroupName $resourceGroupName -Name $cacheName -RedisConfiguration @{"maxmemory-policy" = "allkeys-random"} }
@@ -132,13 +133,13 @@ function Test-RedisCachePipeline
132133
# Setup
133134
$resourceGroupName = "PowerShellTest-2"
134135
$cacheName = "redisteam002"
135-
$location = "West US"
136+
$location = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "West US"
136137

137138
# Create resource group
138139
New-AzResourceGroup -Name $resourceGroupName -Location $location
139140

140141
# Creating Cache
141-
$cacheCreated = New-AzRedisCache -ResourceGroupName $resourceGroupName -Name $cacheName -Location $location -Size 1GB -Sku Standard -EnableNonSslPort $true
142+
$cacheCreated = New-AzRedisCache -ResourceGroupName $resourceGroupName -Name $cacheName -Location $location -Size 1GB -Sku Standard -EnableNonSslPort $true -MinimumTlsVersion 1.2
142143

143144
Assert-AreEqual $cacheName $cacheCreated.Name
144145
Assert-AreEqual $location $cacheCreated.Location
@@ -151,6 +152,7 @@ function Test-RedisCachePipeline
151152
Assert-AreEqual "1GB" $cacheCreated.Size
152153
Assert-AreEqual "Standard" $cacheCreated.Sku
153154
Assert-True { $cacheCreated.EnableNonSslPort }
155+
Assert-AreEqual "1.2" $cacheCreated.MinimumTlsVersion
154156

155157
Assert-NotNull $cacheCreated.PrimaryKey "PrimaryKey do not exists"
156158
Assert-NotNull $cacheCreated.SecondaryKey "SecondaryKey do not exists"
@@ -182,6 +184,7 @@ function Test-RedisCachePipeline
182184
Assert-AreEqual "Standard" $cacheUpdatedPiped.Sku
183185
Assert-AreEqual "allkeys-random" $cacheUpdatedPiped.RedisConfiguration.Item("maxmemory-policy")
184186
Assert-False { $cacheUpdatedPiped.EnableNonSslPort }
187+
Assert-AreEqual "1.2" $cacheUpdatedPiped.MinimumTlsVersion
185188

186189
# Get cache keys
187190
$cacheKeysBeforeUpdate = Get-AzRedisCache -ResourceGroupName $resourceGroupName -Name $cacheName | Get-AzRedisCacheKey
@@ -209,7 +212,7 @@ function Test-RedisCacheClustering
209212
# Setup
210213
$resourceGroupName = "PowerShellTest-3"
211214
$cacheName = "redisteam003"
212-
$location = "West US"
215+
$location = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "West US"
213216

214217
# Create resource group
215218
New-AzResourceGroup -Name $resourceGroupName -Location $location
@@ -325,7 +328,7 @@ function Test-RedisCachePatchSchedules
325328
# Setup
326329
$resourceGroupName = "PowerShellTest-4"
327330
$cacheName = "redisteam004"
328-
$location = "West US"
331+
$location = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "West US"
329332

330333
############################# Initial Creation #############################
331334
# Create resource group
@@ -480,7 +483,7 @@ function Test-ImportExportReboot
480483
# Setup
481484
$resourceGroupName = "PowerShellTest-5"
482485
$cacheName = "redisteam005"
483-
$location = "West US"
486+
$location = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "West US"
484487
$storageName = "redisteam005s"
485488
$storageContainerName = "exportimport"
486489
$prefix = "sunny"
@@ -546,7 +549,7 @@ function Test-DiagnosticOperations
546549
# Setup
547550
$resourceGroupName = "PowerShellTest-6"
548551
$cacheName = "redisteam006"
549-
$location = "West US"
552+
$location = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "West US"
550553
$storageName = "redisteam006s"
551554

552555
############################# Initial Creation #############################
@@ -601,8 +604,8 @@ function Test-GeoReplication
601604
$resourceGroupName = "PowerShellTest-7"
602605
$cacheName1 = "redisteam0071"
603606
$cacheName2 = "redisteam0072"
604-
$location1 = "West US"
605-
$location2 = "East US"
607+
$location1 = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "West US"
608+
$location2 = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "East US"
606609

607610
############################# Initial Creation #############################
608611
# Create resource group
@@ -707,7 +710,7 @@ function Test-FirewallRule
707710
# Setup
708711
$resourceGroupName = "PowerShellTest-8"
709712
$cacheName = "redisteam008"
710-
$location = "West US"
713+
$location = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "West US"
711714
$rule1 = "ruleone"
712715
$rule1StartIp = "10.0.0.0"
713716
$rule1EndIp = "10.0.0.32"
@@ -819,7 +822,7 @@ function Test-Zones
819822
# Setup
820823
$resourceGroupName = "PowerShellTest-9"
821824
$cacheName = "redisteam009"
822-
$location = "East US 2"
825+
$location = Get-Location -providerNamespace "Microsoft.Cache" -resourceType "redis" -preferredLocation "East US"
823826

824827
# Create resource group
825828
New-AzResourceGroup -Name $resourceGroupName -Location $location

0 commit comments

Comments
 (0)