我想使用Bamboo(持續集成解決方案)進行自動部署。我在這裏找到(http://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/#script)一段腳本來幫忙。主要的代碼片段:Azure部署腳本不斷抱怨「CurrentStorageAccount未設置」
#configure powershell with Azure 1.7 modules
Import-Module Azure
#configure powershell with publishsettings for your subscription
$pubsettings = $subscriptionDataFile
Import-AzurePublishSettingsFile $pubsettings
Set-AzureSubscription -CurrentStorageAccount $storageAccountName -SubscriptionName $selectedsubscription
write-host $storageAccountName
write-host "$selectedsubscription"
#set remaining environment variables for Azure cmdlets
$subscription = Get-AzureSubscription $selectedsubscription
$subscriptionname = $subscription.subscriptionname
$subscriptionid = $subscription.subscriptionid
$slot = $environment
#main driver - publish & write progress to activity log
Write-Output "$(Get-Date –f $timeStampFormat) - Azure Cloud Service deploy script started."
Write-Output "$(Get-Date –f $timeStampFormat) - Preparing deployment of $deploymentLabel for $subscriptionname with Subscription ID $subscriptionid."
Publish
$deployment = Get-AzureDeployment -slot $slot -serviceName $servicename
$deploymentUrl = $deployment.Url
Write-Output "$(Get-Date –f $timeStampFormat) - Created Cloud Service with URL $deploymentUrl."
Write-Output "$(Get-Date –f $timeStampFormat) - Azure Cloud Service deploy script finished."
我只是第一次嘗試通過執行powershell E:\CI\OCZDeployment\publish_cloud_service.ps1 -environment Staging -serviceName "ocz" -storageAccountName "t2vsoft" -packageLocation OCZ.cspkg -cloudConfigLocation ServiceConfiguration.Cloud.cscfg -subscriptionDataFile E:\CI\OCZDeployment\SubscriptionDataFile.publishsettings -selectedsubscription "Development Subscription"
,其中publishsettings文件從Azure中運行下載從CMD這個腳本。
但我一直得到錯誤信息:
新AzureDeployment:CurrentStorageAccount未設置。使用Set-AzureSubscription子名稱 - CurrentStorageAccount storageaccount來設置它。
它已經確定在片段中。我甚至嘗試複製&將Set-AzureSubscription行粘貼到New-AzureDeployment函數內。沒有運氣。
幫幫我!謝謝!
非常感謝你爲這個回答!!!它終於有效。 – 2014-10-16 13:07:55