存储帐户问题?

时间:2015-05-24 19:02:44

标签: 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'
   }

如果我在详细说明的情况下运行它,我会得到这个:

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

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

C:> Test-AzureName -Storage myazurefileshare
VERBOSE: The storage account named 'myazurefileshare' is already taken.
True

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

线索?

(对于早期的格式化问题感到抱歉!)

1 个答案:

答案 0 :(得分:6)

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