You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -339,21 +339,92 @@ Azure policies help to enforce organizational standards and to assess compliance
339
339
340
340
### Enable CMK policy enforcement
341
341
342
-
+ For new search services, create them with [SearchEncryptionWithCmk](/rest/api/searchmanagement/services/create-or-update?view=rest-searchmanagement-2023-11-01&tabs=HTTP#searchencryptionwithcmk&preserve-view=true) set to `Enabled`. Neither the Azure portal nor the command line tools (the Azure CLI and Azure PowerShell) provide this property, but you can use [Management REST API](/rest/api/searchmanagement/services/create-or-update) to provision a search service with a CMK policy definition.
342
+
A policy that's assigned to a resource group in your subscription is effective immediately. Audit policies flag non-compliant resources, but Deny policies prevent the creation and update of non-compliant search services. This section explains how to create a compliant search service or update a service to make it compliant. To bring objects into compliance, start at [step one](#step-1-create-an-encryption-key) of this article.
343
343
344
-
+ For existing search services, patch them using [Services - Update API](/rest/api/searchmanagement/services/update).
For new search services, create them with [SearchEncryptionWithCmk](/rest/api/searchmanagement/services/create-or-update?view=rest-searchmanagement-2023-11-01&tabs=HTTP#searchencryptionwithcmk&preserve-view=true) set to `Enabled`.
347
+
348
+
Neither the Azure portal nor the command line tools (the Azure CLI and Azure PowerShell) provide this property natively, but you can use [Management REST API](/rest/api/searchmanagement/services/create-or-update) to provision a search service with a CMK policy definition. You can also use the Azure CLI `az resource create` or `update` command to set properties as name-value pairs.
349
+
350
+
### [**Azure CLI**](#tab/azure-cli-create)
351
+
352
+
1. Create your search service using the examples in [Manage your Azure AI Search service with the Azure CLI](search-manage-azure-cli.md).
353
+
354
+
1. Patch your service using the update command, substituting valid values for an existing search service and resource group.
This example is from [Manage your Azure AI Search service with REST APIs](search-manage-rest.md), modified to include the [SearchEncryptionWithCmk](/rest/api/searchmanagement/services/create-or-update?view=rest-searchmanagement-2023-11-01&tabs=HTTP#searchencryptionwithcmk&preserve-view=true) property.
363
+
364
+
```rest
365
+
### Create a search service (provide an existing resource group)
366
+
@resource-group = my-rg
367
+
@search-service-name = my-search
368
+
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2023-11-01 HTTP/1.1
369
+
Content-type: application/json
370
+
Authorization: Bearer {{token}}
371
+
372
+
{
373
+
"location": "North Central US",
374
+
"sku": {
375
+
"name": "basic"
376
+
},
377
+
"properties": {
378
+
"replicaCount": 1,
379
+
"partitionCount": 1,
380
+
"hostingMode": "default",
381
+
"encryptionWithCmk": {
382
+
"enforcement": "Enabled"
383
+
}
354
384
}
355
-
}
356
-
```
385
+
}
386
+
```
387
+
388
+
---
389
+
390
+
#### Update an existing search service
391
+
392
+
For existing search services that are now non-compliant, patch them using [Services - Update API](/rest/api/searchmanagement/services/update). Patching the services restores the ability to update search service properties.
393
+
394
+
### [**Azure CLI**](#tab/azure-cli-update)
395
+
396
+
Run the following command, substituting valid values for the search service and resource group.
The response should include the following statement:
403
+
404
+
```bash
405
+
"encryptionWithCmk": {
406
+
"encryptionComplianceStatus": "NonCompliant",
407
+
"enforcement": "Enabled"
408
+
}
409
+
...
410
+
```
411
+
412
+
"Non-compliant" means the search service has existing objects that aren't CMK encrypted. To achieve compliance, recreate each object, specifying an encryption key.
0 commit comments