How to Troubleshoot an Azure Storage Account with a Private Endpoint and a Container with Terraform

Guillermo Musumeci
6 min readOct 5, 2023

--

Today, we will discuss a common error when deploying an Azure Azure Storage Account with a Private Endpoint with Terraform.

After we try to add a Storage Account Container, we receive the following error:

Error: containers.Client#GetProperties: Failure responding to request: StatusCode=403 — Original Error: autorest/azure: Service returned an error. Status=403 Code=”AuthorizationFailure” Message=”This request is not authorized to perform this operation.\nRequestId:1b7570b6–101e-005f-296f-f7f2e3000000\nTime:2023–10–05T09:37:49.1892533Z”

1. Our Scenario

  1. We have a virtual machine running Terraform.
  • Resource group “kopicloud-core-dev-we-rg”
  • Virtual Network “kopicloud-core-dev-we-vnet”
  • Subnet “kopicloud-core-dev-we-subnet”

2. We have an existing “privatelink.blob.core.windows.net” Private DNS Zone.

  • Resource group “kopicloud-core-dev-we-dns-rg”

3. We will deploy a new Azure Storage Account with a private endpoint.

  • Resource group “kopicloud-storage-dev-we-rg”
  • Virtual Network “kopicloud-storage-dev-we-vnet”
  • Subnet “kopicloud-storage-dev-we-endpoint-subnet”

2. Terraform Code to Deploy the Azure Storage Account with Private Endpoint

I’m not going to explain the code in this story. Check my story Using Private Endpoint in Azure Storage Account with Terraform for more details.

The “network-variables.tf” file:

variable "network-vnet-cidr" {
type = string
description = "The CIDR of the network VNET"
}

variable "network-endpoint-subnet-cidr" {
type = string
description = "The CIDR for the network subnet"
}

The “network.tf” file:

# Create a resource group for network
resource "azurerm_resource_group" "network-rg" {
name = "kopicloud-storage-dev-we-rg"
location = var.location
}

# Create the network VNET
resource…

--

--

Guillermo Musumeci

Certified AWS, Azure & GCP Architect | HashiCorp Ambassador | Terraform SME | KopiCloud Founder | ex-AWS | Entrepreneur | Book Author | Husband & Dad of ✌