xml - Azure 2014 年 11 月更新将订阅文件格式更改为 JSON

标签 xml json powershell azure

使用 2014 年 11 月的更新更新我的 Powershell 后,Import-PublishedSettingsFile commandlet 将创建 JSON 格式而不是 XML 格式的订阅文件。

如何获取 XML 格式的文件?没有输出格式选项。

背景 当我尝试运行依赖于当前订阅的命令行开关时,此更改似乎会导致无效帐户错误。 Get-AzureService 就是一个示例,它会返回以下错误:

Get-AzureService : Account with name '68BC909D63F2A51F987005620552FB1D643E03DE' does not exist. Parameter name: accountName At C:\UtilityScripts\Modules\AzureVdcConfigFileGenerate\AzureVdcConfigFileGenerate.psm1:189 char:42 + [object] $script:aSourceVdcService = Get-AzureService -ServiceName $sSourceV ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-AzureService], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureServiceCommand

我按如下方式设置订阅:

Set-AzureSubscription -SubscriptionName  $sSourceSubscriptionName   -SubscriptionDataFile $sSourceSubscriptionFileName -CurrentStorageAccountName $sSourceStorageAccountName
Select-AzureSubscription -SubscriptionDataFile $sSourceSubscriptionFileName -NoDefault 
Select-AzureSubscription -SubscriptionDataFile $sSourceSubscriptionFileName -NoCurrent 
Select-AzureSubscription -SubscriptionName $sSourceSubscriptionName -current -SubscriptionDataFile $sSourceSubscriptionFileName 

结果是

SubscriptionId : b6f458b3-0228-48f4-8dec-b7a4884258c6

SubscriptionName : NameOfSubscription

Environment : AzureCloud

SupportedModes : AzureServiceManagement

DefaultAccount : 68BC909D63F2A51F987005620552FB1D643E03DE

Accounts : {68BC909D63F2A51F987005620552FB1D643E03DE}

IsDefault : False

IsCurrent : True

CurrentStorageAccountName : NameOfStorageAccount

我认为 JSON 格式导致了该问题。

最佳答案

这似乎是 Azure PowerShell cmdlet v0.8.8 中引入的错误。错误信息在这里:https://github.com/Azure/azure-sdk-tools/issues/3045微软的开发者已经确认了这个问题。

目前尚不清楚他们是否会修复它,因为 SubscriptionDataFile 参数已被标记为已弃用。然而,我认为提议的新模型实际上还不存在,所以目前还不完全清楚我们应该做什么。使用 v0.8.7.1 可以避免该问题,但如果您需要更新的功能,这并没有帮助。

关于xml - Azure 2014 年 11 月更新将订阅文件格式更改为 JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27134104/

相关文章:

javascript - GetJSON方法只拉取数组,不拉取特定字段

powershell - Powershell开关一对多关联

html - 用 R 抓取 .asp 网站

C# XmL 序列化 - 将项目设置为属性仅显示 XML 中的整数

xml - ASP.NET MVC 4 和 Razor 2 : View engine no longer supports xml?

javascript - 如何将数据从 JSON API 传递到 TypeScript 模型

php - 通过表单更新 JSON?

function - 获取 .ps1 文件中特定函数的最后一行

powershell - 在Windows下将unicode粘贴到vim中的问题

XML 验证错误 - 根元素必须匹配文档类型