我们是否可以将Azure Cloud Service部署设置为构建过程的一部分,以获得与Visual Studio向导相似的结果?
UPD。我们发现了" Azure云服务部署"构建步骤,但它失败并出现以下意外错误(因为实际设置了存储帐户,请参阅下面的完整日志)。
CurrentStorageAccountName is not set. Use Set-AzureSubscription subname -CurrentStorageAccountName storageaccount to set it.
完整日志:
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\tasks\AzureCloudPowerShellDeployment\1.0.13\Publish-AzureCloudDeployment.ps1 Looking for Azure PowerShell module at C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1 AzurePSCmdletsVersion= 0.9.1 Get-ServiceEndpoint -Name ***cut** -Context Microsoft.TeamFoundation.DistributedTask.Agent.Worker.Common.TaskContext Username= ***cut** Add-AzureAccount -Credential $psCredential azureSubscriptionId= ***cut** azureSubscriptionName= ***cut** Select-AzureSubscription -SubscriptionId ***cut** ConnectedServiceName= ***cut** ServiceName= ***cut** ServiceLocation= East US StorageAccount= ***cut** CsPkg= C:\a\c409f63f\***cut**.cspkg CsCfg= C:\a\c409f63f\***cut**.cscfg Slot= Production AllowUpgrade= true Find-Files -SearchPattern C:\a\c409f63f\***cut**.cscfg serviceConfigFile= C:\a\c409f63f\***cut**.cscfg Find-Files -SearchPattern C:\a\c409f63f\***cut**.cspkg servicePackageFile= C:\a\c409f63f\***cut**.cspkg Get-AzureService -ServiceName ***cut** -ErrorAction SilentlyContinue Applying any configured diagnostics extensions. New-AzureServiceDiagnosticsExtensionConfig -Role ***cut** -StorageContext -DiagnosticsConfigurationPath C:\a\c409f63f\***cut**.xml New-AzureServiceDiagnosticsExtensionConfig -Role ***cut** -StorageContext -DiagnosticsConfigurationPath C:\a\c409f63f\***cut**.xml Get-AzureDeployment -ServiceName crgd-scheduler -Slot Production -ErrorAction SilentlyContinue Set-AzureDeployment -Upgrade -ServiceName ***cut** -Package C:\a\c409f63f\***cut**.cspkg -Configuration C:\a\c409f63f\***cut**.cscfg -Slot Production -ExtensionConfiguration CurrentStorageAccountName is not set. Use Set-AzureSubscription subname -CurrentStorageAccountName storageaccount to set it.
答案 0 :(得分:1)
我们终于成功使用了" Azure PowerShell"通用构建步骤和使用Azure API创建/更新Azure部署的自定义PS脚本(New-AzureDeployment
,Set-AzureDeployment
)。
包含完整脚本的精彩文章位于:http://www.kenneth-truyers.net/2014/02/06/deploying-cloud-services-to-azure-with-powershell/。
答案 1 :(得分:0)
在尝试任何命令之前,您需要设置并登录订阅。
我通常将其作为PowerShell的一部分,如果您搜索一下,可以了解如何加密您的凭据,使其不在脚本中。