diff --git a/internal/services/storage/storage_account_resource.go b/internal/services/storage/storage_account_resource.go index eeaab9368496..875a3e9cfe6e 100644 --- a/internal/services/storage/storage_account_resource.go +++ b/internal/services/storage/storage_account_resource.go @@ -198,6 +198,13 @@ func resourceStorageAccount() *pluginsdk.Resource { }, }, }, + + "default_share_level_permission": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(storageaccounts.DefaultSharePermissionNone), + ValidateFunc: validation.StringInSlice(storageaccounts.PossibleValuesForDefaultSharePermission(), false), + }, }, }, }, @@ -2589,6 +2596,7 @@ func expandAccountAzureFilesAuthentication(input []interface{}) (*storageaccount } output.ActiveDirectoryProperties = ad + output.DefaultSharePermission = pointer.To(storageaccounts.DefaultSharePermission(v["default_share_level_permission"].(string))) } return &output, nil @@ -2601,8 +2609,9 @@ func flattenAccountAzureFilesAuthentication(input *storageaccounts.AzureFilesIde return []interface{}{ map[string]interface{}{ - "active_directory": flattenAccountActiveDirectoryProperties(input.ActiveDirectoryProperties), - "directory_type": input.DirectoryServiceOptions, + "active_directory": flattenAccountActiveDirectoryProperties(input.ActiveDirectoryProperties), + "directory_type": input.DirectoryServiceOptions, + "default_share_level_permission": input.DefaultSharePermission, }, } } diff --git a/internal/services/storage/storage_account_resource_test.go b/internal/services/storage/storage_account_resource_test.go index 732d0ff8e67d..d1f329513be2 100644 --- a/internal/services/storage/storage_account_resource_test.go +++ b/internal/services/storage/storage_account_resource_test.go @@ -3477,6 +3477,7 @@ resource "azurerm_storage_account" "test" { forest_name = "adtest.com" netbios_domain_name = "adtest.com" } + default_share_level_permission = "StorageFileDataSmbShareReader" } tags = { @@ -3514,6 +3515,7 @@ resource "azurerm_storage_account" "test" { forest_name = "adtest2.com" netbios_domain_name = "adtest2.com" } + default_share_level_permission = "StorageFileDataSmbShareContributor" } tags = { @@ -3542,7 +3544,8 @@ resource "azurerm_storage_account" "test" { account_replication_type = "LRS" azure_files_authentication { - directory_type = "AADKERB" + directory_type = "AADKERB" + default_share_level_permission = "StorageFileDataSmbShareElevatedContributor" } tags = { diff --git a/website/docs/r/storage_account.html.markdown b/website/docs/r/storage_account.html.markdown index 9ae18a6cb400..7beb3827dd9b 100644 --- a/website/docs/r/storage_account.html.markdown +++ b/website/docs/r/storage_account.html.markdown @@ -375,6 +375,8 @@ A `azure_files_authentication` block supports the following: * `active_directory` - (Optional) A `active_directory` block as defined below. Required when `directory_type` is `AD`. +* `default_share_level_permission` - (Optional) Specifies the default share level permissions applied to all users. Possible values are `StorageFileDataSmbShareReader`, `StorageFileDataSmbShareContributor`, `StorageFileDataSmbShareElevatedContributor`, or `None`. + --- A `active_directory` block supports the following: