Skip to content

Commit ec74bc3

Browse files
authored
[CosmosDB] Fixes issue with Update-AzCosmosDBSqlContainer command on containers with Client Encryption Policy (#18480)
* Support client encryption policy during container creation * Update SqlOperationsTests.ps1 * Update New-AzCosmosDBSqlContainer.md * Update PSClientEncryptionPolicy.cs * Update NewAzCosmosDBSqlContainer.cs * Update ChangeLog.md * Updated package. * Update CosmosDB.Test.csproj * Updated example, session records. * updated session records. * Fixes update container command on containers with client encryption policy. * Update ChangeLog.md * Update ChangeLog.md
1 parent 48459f0 commit ec74bc3

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/CosmosDB/CosmosDB.Test/ScenarioTests/SqlOperationsTests.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,9 @@ function Test-ClientEncryptionKeyCmdlets
10191019
Assert-AreEqual $ContainerWithEncryptionPolicy.Resource.ClientEncryptionPolicy.IncludedPaths[1].EncryptionType $EncryptionType_2
10201020
Assert-AreEqual $ContainerWithEncryptionPolicy.Resource.ClientEncryptionPolicy.PolicyFormatVersion 1
10211021

1022+
#validate update container works on container with encryption policy.
1023+
updateContainerTtl = Update-AzCosmosDBSqlContainer -AccountName $AccountName -ResourceGroupName $rgName -DatabaseName $DatabaseName -TtlInSeconds 7200
1024+
Assert-AreEqual updateContainerTtl.Resource.DefaultTtl 7200
10221025
}
10231026
Finally {
10241027
Remove-AzCosmosDBSqlDatabase -AccountName $AccountName -ResourceGroupName $rgName -Name $DatabaseName

src/CosmosDB/CosmosDB/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Fixed bug related to Update-AzCosmosDBSqlContainer command on containers with Client Encryption Policy.
2223

2324
## Version 1.8.0
2425
* Introduced support for creating containers with Client Encryption Policy. The current supported version of Client Encryption Policy is 1.

src/CosmosDB/CosmosDB/SQL/UpdateAzCosmosDBSqlContainer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ private static SqlContainerResource PopulateSqlContainerResource(SqlContainerGet
216216
DefaultTtl = sqlContainerGetPropertiesResource.DefaultTtl,
217217
Id = sqlContainerGetPropertiesResource.Id,
218218
IndexingPolicy = sqlContainerGetPropertiesResource.IndexingPolicy,
219-
PartitionKey = sqlContainerGetPropertiesResource.PartitionKey
219+
PartitionKey = sqlContainerGetPropertiesResource.PartitionKey,
220+
ClientEncryptionPolicy = sqlContainerGetPropertiesResource.ClientEncryptionPolicy
220221
};
221222
}
222223
}

0 commit comments

Comments
 (0)