-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ron Friedner
committed
Jan 30, 2025
1 parent
9e6cbf9
commit e474822
Showing
2 changed files
with
143 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 34 additions & 5 deletions
39
Powershell scripts/Agentless Scanning CMK support/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,36 @@ | ||
# Add CMK (Customer managed Keys) related permissions for agentless scanning Entra App Id | ||
# Add CMK Permissions for Agentless Scanning | ||
|
||
This script iterate over all VMs in given subscriptions, flitering VMs with CMK (customer managed keys). It then shows all keyvaults connected to these VMs disks Disk Encryption Sets, and optionally | ||
Sets permissions on this keyvaults to allow disk scanning app id to access them. | ||
This script identifies and configures Key Vaults associated with Customer Managed Keys (CMKs) to ensure agentless scanning permissions are in place. | ||
|
||
Usage Example: | ||
.\AddCmkPermissions.ps1 -Subscriptions "Subscription1", "Subscription2" -Apply $true | ||
## Features | ||
|
||
- Grants permissions at **subscription level** (default) or **Key Vault level**. | ||
- Supports Key Vaults in different subscriptions than their disks. | ||
- Detects **access policies** (legacy model) and advises migration to Azure RBAC. | ||
|
||
## EXAMPLES | ||
|
||
```powershell | ||
.\AddCmkPermissions.ps1 -Subscriptions "Subscription1", "Subscription2" -DryRun | ||
.\AddCmkPermissions.ps1 -Subscriptions "Subscription1" -ApplyAtKeyVaultLevel | ||
``` | ||
|
||
## SYNOPSIS | ||
This script iterates over all VMs in specified subscriptions, identifying those with Customer Managed Keys (CMK). It applies RBAC permissions at the **subscription level** by default but can also apply permissions at the **Key Vault level** if specified. | ||
|
||
## PARAMETERS | ||
|
||
### Subscriptions | ||
An array of Azure Subscription IDs. | ||
|
||
### DryRun | ||
A switch parameter to simulate the process without making changes. | ||
|
||
### ApplyAtKeyVaultLevel | ||
A switch parameter to apply permissions at the Key Vault level instead of the default subscription level. | ||
|
||
## NOTES | ||
- **Access Policies Key Vaults**: Subscription-level RBAC permissions do not apply. The script detects such cases and offers options to configure manually. | ||
- **Migration to RBAC is recommended** for better security & manageability. | ||
- Migration Guide: [https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-migration](https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-migration) | ||
- RBAC vs. Access Policies: [https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-access-policy](https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-access-policy) |