Clear/change 使用 Powershell 的存储帐户的 CustomDomainName

Clear/change CustomDomainName for storage account using Powershell

我想为 Azure 存储帐户设置自定义域(v2?,不是经典的)。

为一个域和一个存储帐户设置它。 对于另一个域和另一个存储帐户,我认为我已经正确配置了它但是当我现在尝试配置它时我得到这个错误:

Set-AzureRmStorageAccount -ResourceGroupName "ExampleGroup" -Name "test" -CustomDomainName test.example.com -UseSubDomain $true

Set-AzureRmStorageAccount : CustomDomainNameAlreadySet: Custom domain name is already set.  Current value must be cleared before setting a new value.
+ Set-AzureRmStorageAccount -ResourceGroupName "ExampleGroup" -Name " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzureRmStorageAccount], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.SetAzureStorageAccountCommand

我发现的唯一 answer 意味着人们应该使用经典门户,这不是一种选择,因为那里没有显示 v2 存储帐户。

如何清除 CustomDomainName 值?

目前如果您设置了自定义域名并想替换它,您必须先注销它。要注销它,请将 CustomDomainName 设置为空字符串并且不要发送 UseSubDomain。