01 Run keyvault update command (Windows/macOS/Linux) using the name of the Key Vault instance that you want to reconfigure as identifier parameter (see Audit section part II to identify the right resource) to restrict the default network access (i.e. public access) to the selected Microsoft Azure Key Vault:
az keyvault update
--name "cc-project5-key-vault"
--default-action Deny
02 The command output should return the metadata available for the reconfigured Key Vault:
{
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.KeyVault/vaults/cc-project5-key-vault",
"location": "westeurope",
"name": "cc-project5-key-vault",
"properties": {
"accessPolicies": [
{
"applicationId": null,
"objectId": "abcdabcd-1234-abcd-1234-abcd1234abcd",
"permissions": {
"certificates": [
"Get",
"List",
"Update",
"Create",
"Import",
"Delete",
"Recover",
"Backup",
"Restore",
"ManageContacts",
"ManageIssuers",
"GetIssuers",
"ListIssuers",
"SetIssuers",
"DeleteIssuers"
],
"keys": [
"Get",
"List",
"Update",
"Create",
"Import",
"Delete",
"Recover",
"Backup",
"Restore"
],
"secrets": [
"Get",
"List",
"Set",
"Delete",
"Recover",
"Backup",
"Restore"
],
"storage": null
},
"tenantId": "abcdabcd-1234-abcd-1234-abcd1234abcd"
}
],
"createMode": null,
"enablePurgeProtection": null,
"enableRbacAuthorization": false,
"enableSoftDelete": null,
"enabledForDeployment": true,
"enabledForDiskEncryption": true,
"enabledForTemplateDeployment": true,
"networkAcls": {
"bypass": "AzureServices",
"defaultAction": "Deny",
"ipRules": [],
"virtualNetworkRules": []
},
"provisioningState": "Succeeded",
"sku": {
"name": "standard"
},
"tenantId": "abcdabcd-1234-abcd-1234-abcd1234abcd",
"vaultUri": "https://cc-project5-key-vault.vault.azure.net/"
},
"resourceGroup": "cloud-shell-storage-westeurope",
"tags": {},
"type": "Microsoft.KeyVault/vaults"
}
03 Now that the default network rule is configured to deny all access to your Key Vault resources, you have to configure one of more firewall rules in order to grant access from your trusted IP(s) and/or network(s) only. As example, the following configuration grants access to a specific on-premises network, while blocking general Internet traffic. To allow access from your trusted network only, run keyvault network-rule add command (Windows/macOS/Linux) to add a new network firewall rule for a trusted IP address range (e.g. 16.17.18.0/24):
az keyvault network-rule add
--name "cc-project5-key-vault"
--ip-address 16.17.18.0/24
04 The command output should return the configuration metadata available for the selected Key Vault:
{
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.KeyVault/vaults/cc-project5-key-vault",
"location": "westeurope",
"name": "cc-project5-key-vault",
"properties": {
"accessPolicies": [
{
"applicationId": null,
"objectId": "abcdabcd-1234-abcd-1234-abcd1234abcd",
"permissions": {
"certificates": [
"Get",
"List",
"Update",
"Create",
"Import",
"Delete",
"Recover",
"Backup",
"Restore",
"ManageContacts",
"ManageIssuers",
"GetIssuers",
"ListIssuers",
"SetIssuers",
"DeleteIssuers"
],
"keys": [
"Get",
"List",
"Update",
"Create",
"Import",
"Delete",
"Recover",
"Backup",
"Restore"
],
"secrets": [
"Get",
"List",
"Set",
"Delete",
"Recover",
"Backup",
"Restore"
],
"storage": null
},
"tenantId": "abcdabcd-1234-abcd-1234-abcd1234abcd"
}
],
"createMode": null,
"enablePurgeProtection": null,
"enableRbacAuthorization": false,
"enableSoftDelete": null,
"enabledForDeployment": true,
"enabledForDiskEncryption": true,
"enabledForTemplateDeployment": true,
"networkAcls": {
"bypass": "AzureServices",
"defaultAction": "Deny",
"ipRules": [
{
"value": "16.17.18.0/24"
}
],
"virtualNetworkRules": []
},
"provisioningState": "Succeeded",
"sku": {
"name": "standard"
},
"tenantId": "abcdabcd-1234-abcd-1234-abcd1234abcd",
"vaultUri": "https://cc-project5-key-vault.vault.azure.net/"
},
"resourceGroup": "cloud-shell-storage-westeurope",
"tags": {},
"type": "Microsoft.KeyVault/vaults"
}
05 Repeat steps no. 1 – 4 for each Azure Key Vault available within the current subscription.
06 Repeat steps no. 1 – 5 for each subscription created in your Microsoft Azure cloud account.