Edit

Share via


Update-AzStorageFileServiceProperty

Modifies the service properties for the Azure Storage File service.

Syntax

AccountName (Default)

Update-AzStorageFileServiceProperty
    [-ResourceGroupName] <String>
    [-StorageAccountName] <String>
    [-EnableShareDeleteRetentionPolicy <Boolean>]
    [-ShareRetentionDays <Int32>]
    [-EnableSmbMultichannel <Boolean>]
    [-SmbProtocolVersion <String[]>]
    [-SmbAuthenticationMethod <String[]>]
    [-SmbChannelEncryption <String[]>]
    [-SmbKerberosTicketEncryption <String[]>]
    [-CorsRule <PSCorsRule[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

AccountObject

Update-AzStorageFileServiceProperty
    -StorageAccount <PSStorageAccount>
    [-EnableShareDeleteRetentionPolicy <Boolean>]
    [-ShareRetentionDays <Int32>]
    [-EnableSmbMultichannel <Boolean>]
    [-SmbProtocolVersion <String[]>]
    [-SmbAuthenticationMethod <String[]>]
    [-SmbChannelEncryption <String[]>]
    [-SmbKerberosTicketEncryption <String[]>]
    [-CorsRule <PSCorsRule[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

FileServicePropertiesResourceId

Update-AzStorageFileServiceProperty
    [-ResourceId] <String>
    [-EnableShareDeleteRetentionPolicy <Boolean>]
    [-ShareRetentionDays <Int32>]
    [-EnableSmbMultichannel <Boolean>]
    [-SmbProtocolVersion <String[]>]
    [-SmbAuthenticationMethod <String[]>]
    [-SmbChannelEncryption <String[]>]
    [-SmbKerberosTicketEncryption <String[]>]
    [-CorsRule <PSCorsRule[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Update-AzStorageFileServiceProperty cmdlet modifies the service properties for the Azure Storage File service.

Examples

Example 1: Enable File share softdelete

Update-AzStorageFileServiceProperty -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -EnableShareDeleteRetentionPolicy $true -ShareRetentionDays 5
StorageAccountName                            : mystorageaccount
ResourceGroupName                             : myresourcegroup
ShareDeleteRetentionPolicy.Enabled            : True
ShareDeleteRetentionPolicy.Days               : 5
ProtocolSettings.Smb.Multichannel.Enabled     : False
ProtocolSettings.Smb.Versions                 :
ProtocolSettings.Smb.AuthenticationMethods    :
ProtocolSettings.Smb.KerberosTicketEncryption :
ProtocolSettings.Smb.ChannelEncryption        :

This command enables File share softdelete delete with retention days as 5

Example 2: Enable Smb Multichannel

Update-AzStorageFileServiceProperty -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -EnableSmbMultichannel $true
StorageAccountName                            : mystorageaccount
ResourceGroupName                             : myresourcegroup
ShareDeleteRetentionPolicy.Enabled            : True
ShareDeleteRetentionPolicy.Days               : 5
ProtocolSettings.Smb.Multichannel.Enabled     : True
ProtocolSettings.Smb.Versions                 :
ProtocolSettings.Smb.AuthenticationMethods    :
ProtocolSettings.Smb.KerberosTicketEncryption :
ProtocolSettings.Smb.ChannelEncryption        :

This command enables Smb Multichannel, only supported on Premium FileStorage account.

Example 3: Updates secure smb settings

Update-AzStorageFileServiceProperty -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" `
			-SMBProtocolVersion SMB2.1,SMB3.0,SMB3.1.1  `
			-SMBAuthenticationMethod Kerberos,NTLMv2 `
			-SMBKerberosTicketEncryption RC4-HMAC,AES-256 `
			-SMBChannelEncryption AES-128-CCM,AES-128-GCM,AES-256-GCM
StorageAccountName                            : mystorageaccount
ResourceGroupName                             : myresourcegroup
ShareDeleteRetentionPolicy.Enabled            : True
ShareDeleteRetentionPolicy.Days               : 5
ProtocolSettings.Smb.Multichannel.Enabled     : True
ProtocolSettings.Smb.Versions                 : {SMB2.1, SMB3.0, SMB3.1.1}
ProtocolSettings.Smb.AuthenticationMethods    : {Kerberos, NTLMv2}
ProtocolSettings.Smb.KerberosTicketEncryption : {RC4-HMAC, AES-256}
ProtocolSettings.Smb.ChannelEncryption        : {AES-128-CCM, AES-128-GCM, AES-256-GCM}

This command updates secure smb settings.

Example 4: Clear secure smb settings

Update-AzStorageFileServiceProperty -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" `
			-SMBProtocolVersion @() `
			-SMBAuthenticationMethod @() `
			-SMBKerberosTicketEncryption @() `
			-SMBChannelEncryption @()
StorageAccountName                            : mystorageaccount
ResourceGroupName                             : myresourcegroup
ShareDeleteRetentionPolicy.Enabled            : True
ShareDeleteRetentionPolicy.Days               : 5
ProtocolSettings.Smb.Multichannel.Enabled     : True
ProtocolSettings.Smb.Versions                 :
ProtocolSettings.Smb.AuthenticationMethods    :
ProtocolSettings.Smb.KerberosTicketEncryption :
ProtocolSettings.Smb.ChannelEncryption        :

This command clears secure smb settings.

Example 5: Update CORS rules

$CorsRules = (@{
    AllowedHeaders=@("x-ms-blob-content-type","x-ms-blob-content-disposition");
    ExposedHeaders=@();
    AllowedOrigins=@("*");
    AllowedMethods=@("TRACE","CONNECT")},
    @{
    AllowedOrigins=@("http://www.fabrikam.com","http://www.contoso.com");
    ExposedHeaders=@("x-ms-meta-data*","x-ms-meta-customheader");
    AllowedHeaders=@("x-ms-meta-target*","x-ms-meta-customheader");
    MaxAgeInSeconds=30;
    AllowedMethods=@("PUT")})

$property = Update-AzStorageFileServiceProperty -ResourceGroupName myresourcegroup -StorageAccountName mystorageaccount -CorsRule $CorsRules
$property.Cors.CorsRulesProperty
AllowedOrigins  : {*}
AllowedMethods  : {TRACE, CONNECT}
MaxAgeInSeconds : 0
ExposedHeaders  : {}
AllowedHeaders  : {x-ms-blob-content-type, x-ms-blob-content-disposition}

AllowedOrigins  : {http://www.fabrikam.com, http://www.contoso.com}
AllowedMethods  : {PUT}
MaxAgeInSeconds : 30
ExposedHeaders  : {x-ms-meta-customheader, x-ms-meta-data*}
AllowedHeaders  : {x-ms-meta-customheader, x-ms-meta-target*}

The first command assigns an array of rules to the $CorsRules variable. This command uses standard extends over several lines in this code block. The second command sets the rules in $CorsRules to the File service of a Storage account.

Example 6: Clean up CORS rules

Update-AzStorageFileServiceProperty -ResourceGroupName myresourcegroup -StorageAccountName mystorageaccount -CorsRule @()

This command cleans up the CORS rules of a Storage account by inputting @() to parameter CorsRule.

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

-CorsRule

Specifies CORS rules for the File service.

Parameter properties

Type:

PSCorsRule[]

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

-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

-EnableShareDeleteRetentionPolicy

Enable share Delete Retention Policy for the storage account by set to $true, disable share Delete Retention Policy by set to $false.

Parameter properties

Type:Boolean
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

-EnableSmbMultichannel

Enable Multichannel by set to $true, disable Multichannel by set to $false. Applies to Premium FileStorage only.

Parameter properties

Type:Boolean
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

-ResourceId

Input a Storage account Resource Id, or a File service properties Resource Id.

Parameter properties

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

Parameter sets

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

-ShareRetentionDays

Sets the number of retention days for the share DeleteRetentionPolicy. The value should only be set when enable share Delete Retention Policy.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Days, RetentionDays

Parameter sets

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

-SmbAuthenticationMethod

Gets or sets SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos.

Parameter properties

Type:

String[]

Default value:None
Accepted values:Kerberos, NTLMv2
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

-SmbChannelEncryption

Gets or sets SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM.

Parameter properties

Type:

String[]

Default value:None
Accepted values:AES-128-CCM, AES-128-GCM, AES-256-GCM
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

-SmbKerberosTicketEncryption

Gets or sets kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256.

Parameter properties

Type:

String[]

Default value:None
Accepted values:AES-256, RC4-HMAC
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

-SmbProtocolVersion

Gets or sets SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1.

Parameter properties

Type:

String[]

Default value:None
Accepted values:SMB2.1, SMB3.0, SMB3.1.1
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

-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

-StorageAccountName

Storage Account Name.

Parameter properties

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

Parameter sets

AccountName
Position:1
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

String

Outputs

PSFileServiceProperties