Create Azure File Share With Terraform

This blog post focuses on using Terraform to create an Azure File Share, which is a convenient and powerful way to store and share files in the cloud.

Azure File Shares are part of the Azure Storage Account service, which is a fully managed service that offers scalable, secure, and highly available storage solutions. By using Terraform, you can automate the process of creating an Azure File Share, making it more efficient, reliable, and easier to manage.

Before we begin, make sure you have the following set up:

  • An Azure account with an active subscription
  • Terraform installed (version 0.12 or later)
  • Azure CLI installed and configured with your account

Create a new directory for your Terraform project and create a new file named “” inside the directory. The file will contain the following configuration:

provider "azurerm" {
  features {}

resource "azurerm_resource_group" "rg" {
  name     = "filesharedemo"
  location = "southeastasia"

resource "azurerm_storage_account" "storage" {
  name                     = "ntweeklydemo"
  resource_group_name      =
  location                 = azurerm_resource_group.rg.location
  account_tier             = "Standard"
  account_replication_type = "LRS"

resource "azurerm_storage_share" "fileshare" {
  name                 = "ntweeklyshare"
  storage_account_name =
  quota                = 20

To create an output file that displays information about the created Azure File Share, add an “” file to the same directory as your “” file. In the “” file, include the following content.

output "resource_group_name" {
  value =

output "storage_account_name" {
  value =

output "file_share_name" {
  value =

output "file_share_url" {
  value = "${}/${}"

Terraform will prompt you to confirm the creation of the resources. Type “yes” and press enter to proceed. Once the resources are created, you will see the output variables displaying the relevant information about your Azure File Share.

Example output

resource_group_name = "example-resources"
storage_account_name = "examplestorageacct"
file_share_name = "examplefileshare"
file_share_url = ""

Success! You're on the list.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.