z13 ‐ Vault, key and Key Rotation - SanjeevOCI/Azure GitHub Wiki
Creating a Key Vault
From the left-hand menu, select “All Services” then in the “Security” section , select Key Vault and click on Create.
Fill in the required details and click on “Review+Create” and Create.
We can now see the Key Vault is created,
Create a Key in the Key Vault
In the Azure Portal, Go to “Key Vaults” and select the Key Vault.
In the Key Vault settings, select “Keys” and click on “+Generate/Import”.
The error message "The operation is not allowed by RBAC. If role assignments were recently changed, please wait several minutes for role assignments to become effective." indicates that our Azure user/account does not have the required RBAC (Role-Based Access Control) permissions to perform the action (e.g., generate/import keys) in the Azure Key Vault.
To fix this,
- Navigate to Key Vault --> Access Configuration --> Check if it's using Azure RBAC or Vault access policy.
-
As Azure RBAC is being used, we need to assign Key Vault Administrator (Full access) or Key Vault Crypto Officer (for keys only). we will go with Key Vault Administrator role.
-
To assign the role, Navigate to Key Vault --> Access control (IAM) --> Click + Add --> Add role assignment --> Select "Key Vault Administrator" --> Assign to your user account, group, or service principal --> Click Save.
-
RBAC assignments can take 5–10 minutes to take effect. Wait a few minutes before retrying.
-
After few minutes, Navigate to Key Vault settings, select “Keys” and click on “+Generate/Import”. We do not see the error message now.
-
Fill the required details and click on “Create”.
We can see the key is created.
Rotate the Key
In the Key Vault settings, select “Keys”, and select the key which we want to rotate. Click on “New Version”.
Fill the required details and click on “Create”.
We can now see the new key is created,
Automate Key Rotation
We also have an option to automate this key rotation.
For this we have to go into key we want to rotate and click on “Rotation Policy”.
Select the rotation policy and “Enable” auto rotation.
Click on Save and then the key will be automatically rotated as per the rotation policy.