使用 Windows PowerShell 来管理和开发 windowsazure.cn 账户的特别注意事项

6月6日,微软面向中国大陆用户开放了Microsoft Azure公众预览版的申请界面。大家可以申请免费的 beta 试用,收到内附邀请码的通知邮件后只需输入激活码即可开始免费试用。具体网址为:

http://windowsazure.cn/zh-cn/pricing/free-trial/

在实际使用这个账号的时候,发现有一些地方需要特别注意。

在使用PowerShell工具中,需要下载发布配置文件(PublishSettingProfile),从而获得设置Windows PowerShell环境的变量。具体方法是登录Microsoft Azure账户的管理门户后,访问下面地址即可获得:https://windows.azure.com/download/publishprofile.aspx

关于这一操作的说明具体请见:

http://msdn.microsoft.com/en-us/library/windowsazure/jj554332.aspx

但是在使用Windowsazure.cn的账号的时候,发现无法通过上述方法得到PublishSettingProfile。

经了解,需要到下述地址来获得:

https://manage.windowsazure.cn/publishsettings/index

下载后进行对比,发现两者文件格式上有些差异。

通过https://windows.azure.com/download/publishprofile.aspx,获得格式样例如下:

 
 
<?xml version="1.0" encoding="utf-8"?>
    <PublishData>
        <PublishProfile
                PublishMethod="AzureServiceManagementAPI"
                Url="https://management.core.windows.net/"
                ManagementCertificate="{Subscription’s management certificate}” 
            <Subscription
                Id="{Subscription’s ID} "
                Name="{Subscription’s Name} " />
        </PublishProfile>
    </PublishData>

而在https://manage.windowsazure.cn/publishsettings/index下载的文件格式为:

 
 
<?xml version="1.0" encoding="utf-8"?>
        <PublishData>
            <PublishProfile
                     SchemaVersion="2.0"
                     PublishMethod="AzureServiceManagementAPI">
                     <Subscription
                                ServiceManagementUrl="https://management.core.chinacloudapi.cn"
                                Id="{Subscription’s ID}"
                                Name="{Subscription’s Name} "
                                ManagementCertificate="{Subscription’s management certificate}" />
            </PublishProfile>
        </PublishData>

同时,建议访问https://github.com/WindowsAzure/azure-sdk-tools,获取最新的Microsoft Azure Powershell,这样在使用命令行Import-AzurePublishSettingsFile的时候,不易发生错误。

原文地址:https://www.cnblogs.com/duanweishi/p/4172837.html