4

Bamboo(継続的インテグレーションソリューション)を使用して自動展開を実行したいと思います。ここ(http://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/#script)で役立つスクリプトを見つけました。メインコードスニペット:

#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."

私は最初にcmdからこのスクリプトを実行してみました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からダウンロードされます。

しかし、私はエラーメッセージを受け取り続けました:

New-AzureDeployment:CurrentStorageAccountが設定されていません。Set-AzureSubscription subname-CurrentStorageAccountstorageaccountを使用して設定します。

それは間違いなくスニペットで設定されています。Set-AzureSubscription行をコピーしてNew-AzureDeployment関数内に貼り付けてみました。運がない。

助けて!ありがとうございました!

4

2 に答える 2

4

修理済み。正確な原因はわかりませんが、次を実行して、登録されているすべてのAzureサブスクリプションを削除しました。

PS> Get-AzureSubscription | ForEach-Object { Remove-AzureSubscription $_.SubscriptionName }

次のコマンドを実行して、サブスクリプションを再インポートしました。

PS> Import-AzurePublishSettingsFile xxx.publishsettings

そしてそれはすべてうまくいきました!:)

サブスクリプションリストには、実際には同じような名前のサブスクリプションがいくつかありました。紺碧のスクリプトが本当に必要なものを認識していなかったため、競合が発生した可能性があります。

于 2013-03-19T03:32:40.667 に答える
1

複数のサブスクリプションがある場合は、使用するサブスクリプションがデフォルトに設定されていることを確認する必要があります。これは、次の方法で実行できます。

Select-AzureSubscription -SubscriptionName "{subscriptionName}" -Default

サブスクリプション名がわからない場合は、以下を使用してすべてのサブスクリプションを表示できます。

Get-AzureSubscription
于 2014-08-01T16:06:09.413 に答える