File Services - Set Service Properties

Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default?api-version=2023-05-01

URI Parameters

Name In Required Type Description
accountName
path True

string

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.

Regex pattern: ^[a-z0-9]+$

FileServicesName
path True

FileServicesName

The name of the file Service within the specified storage account. File Service Name must be "default"

resourceGroupName
path True

string

The name of the resource group within the user's subscription. The name is case insensitive.

Regex pattern: ^[-\w\._\(\)]+$

subscriptionId
path True

string

The ID of the target subscription.

api-version
query True

string

The API version to use for this operation.

Request Body

Name Type Description
properties.cors

CorsRules

Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service.

properties.protocolSettings

ProtocolSettings

Protocol settings for file service

properties.shareDeleteRetentionPolicy

DeleteRetentionPolicy

The file service properties for share soft delete.

Responses

Name Type Description
200 OK

FileServiceProperties

OK -- Sets The properties of a storage account’s File service successfully.

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

PutFileServices
PutFileServices_EnableSecureSmbFeatures
PutFileServices_EnableSMBMultichannel

PutFileServices

Sample request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/fileServices/default?api-version=2023-05-01

{
  "properties": {
    "cors": {
      "corsRules": [
        {
          "allowedOrigins": [
            "http://www.contoso.com",
            "http://www.fabrikam.com"
          ],
          "allowedMethods": [
            "GET",
            "HEAD",
            "POST",
            "OPTIONS",
            "MERGE",
            "PUT"
          ],
          "maxAgeInSeconds": 100,
          "exposedHeaders": [
            "x-ms-meta-*"
          ],
          "allowedHeaders": [
            "x-ms-meta-abc",
            "x-ms-meta-data*",
            "x-ms-meta-target*"
          ]
        },
        {
          "allowedOrigins": [
            "*"
          ],
          "allowedMethods": [
            "GET"
          ],
          "maxAgeInSeconds": 2,
          "exposedHeaders": [
            "*"
          ],
          "allowedHeaders": [
            "*"
          ]
        },
        {
          "allowedOrigins": [
            "http://www.abc23.com",
            "https://www.fabrikam.com/*"
          ],
          "allowedMethods": [
            "GET",
            "PUT"
          ],
          "maxAgeInSeconds": 2000,
          "exposedHeaders": [
            "x-ms-meta-abc",
            "x-ms-meta-data*",
            "x-ms-meta-target*"
          ],
          "allowedHeaders": [
            "x-ms-meta-12345675754564*"
          ]
        }
      ]
    }
  }
}

Sample response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/fileServices/default",
  "name": "default",
  "type": "Microsoft.Storage/storageAccounts/fileServices",
  "properties": {
    "cors": {
      "corsRules": [
        {
          "allowedOrigins": [
            "http://www.contoso.com",
            "http://www.fabrikam.com"
          ],
          "allowedMethods": [
            "GET",
            "HEAD",
            "POST",
            "OPTIONS",
            "MERGE",
            "PUT"
          ],
          "maxAgeInSeconds": 100,
          "exposedHeaders": [
            "x-ms-meta-*"
          ],
          "allowedHeaders": [
            "x-ms-meta-abc",
            "x-ms-meta-data*",
            "x-ms-meta-target*"
          ]
        },
        {
          "allowedOrigins": [
            "*"
          ],
          "allowedMethods": [
            "GET"
          ],
          "maxAgeInSeconds": 2,
          "exposedHeaders": [
            "*"
          ],
          "allowedHeaders": [
            "*"
          ]
        },
        {
          "allowedOrigins": [
            "http://www.abc23.com",
            "https://www.fabrikam.com/*"
          ],
          "allowedMethods": [
            "GET",
            "PUT"
          ],
          "maxAgeInSeconds": 2000,
          "exposedHeaders": [
            "x-ms-meta-abc",
            "x-ms-meta-data*",
            "x-ms-meta-target*"
          ],
          "allowedHeaders": [
            "x-ms-meta-12345675754564*"
          ]
        }
      ]
    }
  },
  "sku": {
    "name": "Standard_GRS",
    "tier": "Standard"
  }
}

PutFileServices_EnableSecureSmbFeatures

Sample request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/fileServices/default?api-version=2023-05-01

{
  "properties": {
    "protocolSettings": {
      "smb": {
        "versions": "SMB2.1;SMB3.0;SMB3.1.1",
        "authenticationMethods": "NTLMv2;Kerberos",
        "kerberosTicketEncryption": "RC4-HMAC;AES-256",
        "channelEncryption": "AES-128-CCM;AES-128-GCM;AES-256-GCM"
      }
    }
  }
}

Sample response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/fileServices/default",
  "name": "default",
  "type": "Microsoft.Storage/storageAccounts/fileServices",
  "properties": {
    "protocolSettings": {
      "smb": {
        "versions": "SMB2.1;SMB3.0;SMB3.1.1",
        "authenticationMethods": "NTLMv2;Kerberos",
        "kerberosTicketEncryption": "RC4-HMAC;AES-256",
        "channelEncryption": "AES-128-CCM;AES-128-GCM;AES-256-GCM"
      }
    }
  },
  "sku": {
    "name": "Premium_LRS",
    "tier": "Premium"
  }
}

PutFileServices_EnableSMBMultichannel

Sample request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/fileServices/default?api-version=2023-05-01

{
  "properties": {
    "protocolSettings": {
      "smb": {
        "multichannel": {
          "enabled": true
        }
      }
    }
  }
}

Sample response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/fileServices/default",
  "name": "default",
  "type": "Microsoft.Storage/storageAccounts/fileServices",
  "properties": {
    "protocolSettings": {
      "smb": {
        "multichannel": {
          "enabled": true
        }
      }
    }
  },
  "sku": {
    "name": "Premium_LRS",
    "tier": "Premium"
  }
}

Definitions

Name Description
AllowedMethods

Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin.

CloudError

An error response from the Storage service.

CloudErrorBody

An error response from the Storage service.

CorsRule

Specifies a CORS rule for the Blob service.

CorsRules

Sets the CORS rules. You can include up to five CorsRule elements in the request.

DeleteRetentionPolicy

The service properties for soft delete.

FileServiceProperties

The properties of File services in storage account.

FileServicesName

The name of the file Service within the specified storage account. File Service Name must be "default"

Multichannel

Multichannel setting. Applies to Premium FileStorage only.

ProtocolSettings

Protocol settings for file service

Sku

The SKU of the storage account.

SkuName

The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType.

SkuTier

The SKU tier. This is based on the SKU name.

SmbSetting

Setting for SMB protocol

AllowedMethods

Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin.

Name Type Description
CONNECT

string

DELETE

string

GET

string

HEAD

string

MERGE

string

OPTIONS

string

PATCH

string

POST

string

PUT

string

TRACE

string

CloudError

An error response from the Storage service.

Name Type Description
error

CloudErrorBody

An error response from the Storage service.

CloudErrorBody

An error response from the Storage service.

Name Type Description
code

string

An identifier for the error. Codes are invariant and are intended to be consumed programmatically.

details

CloudErrorBody[]

A list of additional details about the error.

message

string

A message describing the error, intended to be suitable for display in a user interface.

target

string

The target of the particular error. For example, the name of the property in error.

CorsRule

Specifies a CORS rule for the Blob service.

Name Type Description
allowedHeaders

string[]

Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request.

allowedMethods

AllowedMethods[]

Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin.

allowedOrigins

string[]

Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains

exposedHeaders

string[]

Required if CorsRule element is present. A list of response headers to expose to CORS clients.

maxAgeInSeconds

integer

Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response.

CorsRules

Sets the CORS rules. You can include up to five CorsRule elements in the request.

Name Type Description
corsRules

CorsRule[]

The List of CORS rules. You can include up to five CorsRule elements in the request.

DeleteRetentionPolicy

The service properties for soft delete.

Name Type Description
allowPermanentDelete

boolean

This property when set to true allows deletion of the soft deleted blob versions and snapshots. This property cannot be used blob restore policy. This property only applies to blob service and does not apply to containers or file share.

days

integer

Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365.

enabled

boolean

Indicates whether DeleteRetentionPolicy is enabled.

FileServiceProperties

The properties of File services in storage account.

Name Type Description
id

string

Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

The name of the resource

properties.cors

CorsRules

Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service.

properties.protocolSettings

ProtocolSettings

Protocol settings for file service

properties.shareDeleteRetentionPolicy

DeleteRetentionPolicy

The file service properties for share soft delete.

sku

Sku

Sku name and tier.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

FileServicesName

The name of the file Service within the specified storage account. File Service Name must be "default"

Name Type Description
default

string

Multichannel

Multichannel setting. Applies to Premium FileStorage only.

Name Type Description
enabled

boolean

Indicates whether multichannel is enabled

ProtocolSettings

Protocol settings for file service

Name Type Description
smb

SmbSetting

Setting for SMB protocol

Sku

The SKU of the storage account.

Name Type Description
name

SkuName

The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType.

tier

SkuTier

The SKU tier. This is based on the SKU name.

SkuName

The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType.

Name Type Description
Premium_LRS

string

Premium_ZRS

string

Standard_GRS

string

Standard_GZRS

string

Standard_LRS

string

Standard_RAGRS

string

Standard_RAGZRS

string

Standard_ZRS

string

SkuTier

The SKU tier. This is based on the SKU name.

Name Type Description
Premium

string

Standard

string

SmbSetting

Setting for SMB protocol

Name Type Description
authenticationMethods

string

SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'.

channelEncryption

string

SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'.

kerberosTicketEncryption

string

Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';'

multichannel

Multichannel

Multichannel setting. Applies to Premium FileStorage only.

versions

string

SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a string with delimiter ';'.