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所说的实际存储帐户?
线索?
(抱歉早期的格式化问题!)
归档时间: |
|
查看次数: |
1728 次 |
最近记录: |