Azure Storage Encryption Scope
This page shows how to write Terraform and Azure Resource Manager for Storage Encryption Scope and write them securely.
azurerm_storage_encryption_scope (Terraform)
The Encryption Scope in Storage can be configured in Terraform with the resource name azurerm_storage_encryption_scope
. The following sections describe 3 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_storage_encryption_scope" "ses" {
name = var.res_ses_name
storage_account_id = var.res_storage_account_id
source = "Microsoft.Storage"
resource "azurerm_storage_encryption_scope" "sae" {
name = var.res_sae_name
storage_account_id = var.res_storage_account_id
source = "Microsoft.Storage"
resource "azurerm_storage_encryption_scope" "dev_ops" {
name = "microsoftmanaged"
storage_account_id = azurerm_storage_account.dev_ops.id
source = "Microsoft.Storage"
}
Parameters
-
id
optional computed - string -
key_vault_key_id
optional - string -
name
required - string -
source
required - string -
storage_account_id
required - string -
timeouts
single block
Explanation in Terraform Registry
Manages a Storage Encryption Scope.
Note: Storage Encryption Scopes are in Preview more information can be found here.
Tips: Best Practices for The Other Azure Storage Resources
In addition to the azurerm_storage_account, Azure Storage has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_storage_account
Ensure to use HTTPS connections
It is better to use HTTPS instead of HTTP, which could be vulnerable to person-in-the-middle attacks.
azurerm_storage_account_network_rules
Ensure to allow Trusted Microsoft Services to bypass
It is better to allow Trusted Microsoft Services to bypass. They are not able to access storage account unless rules are set to allow them explicitly.
Microsoft.Storage/storageAccounts/encryptionScopes (Azure Resource Manager)
The storageAccounts/encryptionScopes in Microsoft.Storage can be configured in Azure Resource Manager with the resource name Microsoft.Storage/storageAccounts/encryptionScopes
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
apiVersion
required - stringname
required - stringThe name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
properties
optionalkeyVaultProperties
optionalkeyUri
optional - stringThe object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope.
requireInfrastructureEncryption
optional - booleanA boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest.
source
optional - stringThe provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault.
state
optional - stringThe state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled.
type
required - string
Frequently asked questions
What is Azure Storage Encryption Scope?
Azure Storage Encryption Scope is a resource for Storage of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Storage Encryption Scope?
For Terraform, the avishekansible/AzureLandingZone, avishekansible/AzureLandingZone and dmaxim/terrademo source code examples are useful. See the Terraform Example section for further details.