Edit

Share via


New-AzStorageEncryptionScope

Creates an encryption scope for a Storage account.

Syntax

AccountName (Default)

New-AzStorageEncryptionScope
    [-ResourceGroupName] <String>
    [-StorageAccountName] <String>
    -EncryptionScopeName <String>
    [-StorageEncryption]
    [-RequireInfrastructureEncryption]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

AccountNameKeyVault

New-AzStorageEncryptionScope
    [-ResourceGroupName] <String>
    [-StorageAccountName] <String>
    -EncryptionScopeName <String>
    -KeyUri <String>
    [-KeyvaultEncryption]
    [-RequireInfrastructureEncryption]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

AccountObject

New-AzStorageEncryptionScope
    -StorageAccount <PSStorageAccount>
    -EncryptionScopeName <String>
    [-StorageEncryption]
    [-RequireInfrastructureEncryption]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

AccountObjectKeyVault

New-AzStorageEncryptionScope
    -StorageAccount <PSStorageAccount>
    -EncryptionScopeName <String>
    -KeyUri <String>
    [-KeyvaultEncryption]
    [-RequireInfrastructureEncryption]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The New-AzStorageEncryptionScope cmdlet creates an encryption scope for a Storage account.

Examples

Example 1: Create an encryption scope with Storage Encryption

New-AzStorageEncryptionScope -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount"  -EncryptionScopeName testscope -StorageEncryption
ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name      State    Source            KeyVaultKeyUri RequireInfrastructureEncryption
----      -----    ------            -------------- -------------------------------
testscope Enabled  Microsoft.Storage

This command creates an encryption scope with Storage Encryption.

Example 2: Create an encryption scope with Keyvault Encryption, and RequireInfrastructureEncryption

New-AzStorageEncryptionScope -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" `
	-EncryptionScopeName testscope -KeyvaultEncryption -KeyUri "https://keyvalutname.vault.azure.net:443/keys/keyname/34a0ba563b4243d9a0ef2b1d3c0c7d57" `
	-RequireInfrastructureEncryption
ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name         State   Source           KeyVaultKeyUri                                                                          RequireInfrastructureEncryption
----         -----   ------             --------------                                                                        -------------------------------
testscope Enabled  Microsoft.Keyvault https://keyvalutname.vault.azure.net:443/keys/keyname/34a0ba563b4243d9a0ef2b1d3c0c7d57  True

This command creates an encryption scope with Keyvault Encryption and RequireInfrastructureEncryption. The Storage account Identity need have get,wrapkey,unwrapkey permissions to the keyvault key.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EncryptionScopeName

Azure Storage EncryptionScope name

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Name

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeyUri

The key Uri

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AccountNameKeyVault
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountObjectKeyVault
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeyvaultEncryption

Create encryption scope with keySource as Microsoft.Keyvault

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AccountNameKeyVault
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountObjectKeyVault
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RequireInfrastructureEncryption

The encryption scope will apply a secondary layer of encryption with platform managed keys for data at rest.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

Resource Group Name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AccountName
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountNameKeyVault
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StorageAccount

Storage account object

Parameter properties

Type:PSStorageAccount
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AccountObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
AccountObjectKeyVault
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-StorageAccountName

Storage Account Name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AccountName

Parameter sets

AccountName
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountNameKeyVault
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StorageEncryption

Create encryption scope with keySource as Microsoft.Storage.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AccountName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

PSStorageAccount

Outputs

PSEncryptionScope