[英]Terraform and Azure: Unable to provision Storage Account
我正在尝试配置一个存储帐户,但运行它会导致错误:
Error: Error reading static website for AzureRM Storage Account "sa12345461234512name":
accounts.Client#GetServiceProperties:
Failure responding to request: StatusCode=403 -- Original Error: autorest/azure:
Service returned an error. Status=403 Code="AuthorizationPermissionMismatch"
Message="This request is not authorized to perform this operation using this permission.\n
RequestId:05930d46-301e-00ac-6d72-f021f0000000\n
Time:2020-03-02T09:09:44.9417598Z"
运行操作系统 Windows 10 专业版。
复制步骤(在安装了 Azure CLI 的 Powershell 中)
配置文件内容
# Configure the Azure Provider
provider "azurerm" {
version = "=2.0.0"
features {}
}
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "Australia East"
}
resource "azurerm_storage_account" "example" {
name = "sa12345461234512name"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
tags = {
environment = "staging"
}
}
不确定我缺少什么,所有其他资源都可以正常工作,只是存储帐户。
这是 azure 提供程序中的一个错误,请参阅: https : //github.com/terraform-providers/terraform-provider-azurerm/issues/5869
更新您的提供商; 它似乎与 terraform 版本无关。
从:
# Configure the Azure Provider
provider "azurerm" {
# whilst the `version` attribute is optional, we recommend pinning to a given version of the Provider
version = "=2.0.0"
features {}
}
到:
provider "azurerm" {
version = "~> 2.1.0"
features {}
}
只是为了补充这一点,因为以上都没有奏效。 在我的情况下,它首先不起作用,然后第二天工作只是为了在晚上不再工作......没有改变版本或任何东西,是同一台电脑。
事实证明,我在 Windows 中运行的 Ubuntu 上的时间设置有偏差。 只需运行sudo ntpdate time.nist.gov
来更新时间即可解决问题。
发现问题。 它与 Terraform 有关。 刚刚检查了更新并通知 0.12.21 已发布(我正在运行 0.12.20)。
似乎如果运行 AzureARM 2.0.0 那么真的需要最小 0.12.21 才能使其工作。
与@tesharp遇到的问题相同。 在我的 Ubuntu WSL2 上,以下命令解决了这个问题:
sudo hwclock -s
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.