存储帐户问题?

Tho*_*Lee 2 azure azure-storage

我正在尝试创建一个存储组,并遇到了一些问题.

这是我正在使用的代码:

$StorageAccountName = 'myazurefileshare'
$Share              = 'FileShare'
$Location           = 'North Europe'
$ac = Get-AzureStorageAccount -StorageAccountName $StorageAccountName -ErrorAction SilentlyContinue
"Storage account exists? [$(if ($ac) {$true} else {$false})]"
If (!$ac)  # Does not exist - so create it
   {
     Write-Verbose "Storage Account [$StorageAccountName] in [$Location] does not exist"
     Write-Verbose "Creating Storage Account [$StorageAccountName] in [$Location]"
     New-AzureStorageAccount -StorageAccountName $StorageAccountName `
        -Location $Location -type 'Standard_GRS'
   }
Run Code Online (Sandbox Code Playgroud)

如果我用详细的方式运行它,我得到这个:

VERBOSE: 19:58:11 - Begin Operation: Get-AzureStorageAccount
VERBOSE: 19:58:12 - Completed Operation: Get-AzureStorageAccount
Storage account exists? [False]
VERBOSE: Storage Account [myazurefileshare] in [North Europe] does not exist
VERBOSE: Creating Storage Account [myazurefileshare] in [North Europe]
VERBOSE: 19:58:12 - Begin Operation: New-AzureStorageAccount
New-AzureStorageAccount : ConflictError: The storage account named 'myazurefileshare' is already taken.
At line:13 char:6
+      New-AzureStorageAccount -StorageAccountName $StorageAccountName  ...
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureStorageAccount], CloudException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.StorageServices.NewAzureStorageAccountCommand

VERBOSE: 19:58:14 - Completed Operation: New-AzureStorageAccount
Run Code Online (Sandbox Code Playgroud)

所以 - 当我执行Get-AzureStorageAccount时,它告诉我存储帐户不存在.但是当我尝试创建它时,它会因名称存在而失败.不用说,Test-AzureName与返回的错误一致:

C:> Test-AzureName -Storage myazurefileshare
VERBOSE: The storage account named 'myazurefileshare' is already taken.
True
Run Code Online (Sandbox Code Playgroud)

那么,为什么Get-AzureStorageAccount不会返回Test-Azurename所说的实际存储帐户?

线索?

(抱歉早期的格式化问题!)

小智 6

存储帐户名称在订阅中是唯一的.当您尝试列出具有给定名称的帐户时,在您的订阅下找不到该帐户,但是由其他人使用,并且不允许您创建具有相同名称的另一个存储帐户.