Skip to content

Commit ad54124

Browse files
committed
Changed some formatting and flipped CLI/REST examples, leading with REST
1 parent 9a82177 commit ad54124

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

articles/search/search-security-manage-encryption-keys.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Azure policies help to enforce organizational standards and to assess compliance
320320
321321
| Effect | Effect if enabled|
322322
|--------|------------------|
323-
| [**AuditIfNotExists**](/azure/governance/policy/concepts/effect-audit-if-not-exists) | Checks for compliance: do objects have a customer-managed key defined, and is the content encrypted. This effect applies to existing services with content. It's evaluated each time an object is created or updated, or [per the evaluation schedule](/azure/governance/policy/overview#understand-evaluation-outcomes). [Learn more...](https://portal.azure.com/#view/Microsoft_Azure_Policy/PolicyDetailBlade/definitionId/%2Fproviders%2FMicrosoft.Authorization%2FpolicyDefinitions%2F356da939-f20a-4bb9-86f8-5db445b0e354) |
323+
| [**AuditIfNotExists**](/azure/governance/policy/concepts/effect-audit-if-not-exists) | Checks for policy compliance: do objects have a customer-managed key defined, and is the content encrypted. This effect applies to existing services with content. It's evaluated each time an object is created or updated, or [per the evaluation schedule](/azure/governance/policy/overview#understand-evaluation-outcomes). [Learn more...](https://portal.azure.com/#view/Microsoft_Azure_Policy/PolicyDetailBlade/definitionId/%2Fproviders%2FMicrosoft.Authorization%2FpolicyDefinitions%2F356da939-f20a-4bb9-86f8-5db445b0e354) |
324324
| [**Deny**](/azure/governance/policy/concepts/effect-deny) | Checks for policy enforcement: does the search service have [SearchEncryptionWithCmk](/rest/api/searchmanagement/services/create-or-update?view=rest-searchmanagement-2023-11-01&tabs=HTTP#searchencryptionwithcmk&preserve-view=true) set to `Enabled`. This effect applies to new services only, which must be created with encryption enabled. Existing services remain operational but you can't update them unless you patch the service. None of the tools used for provisioning services expose this property, so be aware that setting the policy limits you to [programmatic set up](#enable-cmk-policy-enforcement).|
325325
326326
### Assign a policy
@@ -331,6 +331,8 @@ Azure policies help to enforce organizational standards and to assess compliance
331331
332332
+ [Deny](https://portal.azure.com/#view/Microsoft_Azure_Policy/PolicyDetailBlade/definitionId/%2Fproviders%2FMicrosoft.Authorization%2FpolicyDefinitions%2F356da939-f20a-4bb9-86f8-5db445b0e354)
333333
334+
Here's an example of the **AuditIfExists** policy in the Azure portal:
335+
334336
:::image type="content" source="media/search-security-manage-encryption-keys/assign-policy.png" alt-text="Screenshot of assigning built-in CMK policy." border="true":::
335337
336338
1. Set [policy scope](/azure/governance/policy/concepts/scope) by selecting the subscription and resource group. Exclude any search services for which the policy shouldn't apply.
@@ -347,16 +349,6 @@ For new search services, create them with [SearchEncryptionWithCmk](/rest/api/se
347349
348350
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.
349351
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.
355-
356-
```azurecli
357-
az resource update --name SEARCH-SERVICE-PLACEHOLDER --resource-group RESOURCE-GROUP-PLACEHOLDER --resource-type searchServices --namespace Microsoft.Search --set properties.encryptionWithCmk.enforcement=Enabled
358-
```
359-
360352
### [**Management REST API**](#tab/mgmt-rest-create)
361353
362354
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.
@@ -385,12 +377,36 @@ PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups
385377
}
386378
```
387379

380+
### [**Azure CLI**](#tab/azure-cli-create)
381+
382+
1. Create your search service using the examples in [Manage your Azure AI Search service with the Azure CLI](search-manage-azure-cli.md).
383+
384+
1. Patch your service using the update command, substituting valid values for an existing search service and resource group.
385+
386+
```azurecli
387+
az resource update --name SEARCH-SERVICE-PLACEHOLDER --resource-group RESOURCE-GROUP-PLACEHOLDER --resource-type searchServices --namespace Microsoft.Search --set properties.encryptionWithCmk.enforcement=Enabled
388+
```
389+
388390
---
389391

390392
#### Update an existing search service
391393

392394
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.
393395

396+
### [**Management REST API**](#tab/mgmt-rest-update)
397+
398+
```http
399+
PATCH https://management.azure.com/subscriptions/<your-subscription-Id>/resourceGroups/<your-resource-group-name>/providers/Microsoft.Search/searchServices/<your-search-service-name>?api-version=2023-11-01
400+
401+
{
402+
"properties": {
403+
"encryptionWithCmk": {
404+
"enforcement": "Enabled"
405+
}
406+
}
407+
}
408+
```
409+
394410
### [**Azure CLI**](#tab/azure-cli-update)
395411

396412
Run the following command, substituting valid values for the search service and resource group.
@@ -411,19 +427,6 @@ The response should include the following statement:
411427

412428
"Non-compliant" means the search service has existing objects that aren't CMK encrypted. To achieve compliance, recreate each object, specifying an encryption key.
413429

414-
### [**Management REST API**](#tab/mgmt-rest-update)
415-
416-
```http
417-
PATCH https://management.azure.com/subscriptions/<your-subscription-Id>/resourceGroups/<your-resource-group-name>/providers/Microsoft.Search/searchServices/<your-search-service-name>?api-version=2023-11-01
418-
419-
{
420-
"properties": {
421-
"encryptionWithCmk": {
422-
"enforcement": "Enabled"
423-
}
424-
}
425-
}
426-
```
427430
---
428431

429432
## Rotate or update encryption keys

0 commit comments

Comments
 (0)