Sunday 15 September 2013

azure - Deploy a Cloud Service using Powershell and Teamcity fails -



azure - Deploy a Cloud Service using Powershell and Teamcity fails -

i seek deploy cloud service using powershell , teamcity. worked fine in past, cannot create work on new machine.

this powershell script:

write-output "$(get-date -f g) - running azure imports" import-azurepublishsettingsfile -publishsettingsfile "%publishsettingsfilename%" set-azuresubscription -currentstorageaccountname "%blobaccountname%" -subscriptionname "%subscriptionname%" select-azuresubscription -subscriptionname "%subscriptionname%" function publish(){ $deployment = get-azuredeployment -servicename "%cloudservicename%" -slot "%cloudserviceslot%" -errorvariable -erroraction silentlycontinue if ($a[0] -ne $null) { write-output "$(get-date -f g) - no deployment detected. creating new deployment. " } if ($deployment.name -ne $null) { #update deployment inplace (usually faster, cheaper, won't destroy vip) write-output "$(get-date -f g) - deployment exists in %cloudservicename%. upgrading deployment." upgradedeployment } else { createnewdeployment } } function createnewdeployment() { write-progress -id 3 -activity "creating new deployment" -status "in progress" write-output "$(get-date -f g) - creating new deployment: in progress" $opstat = new-azuredeployment -slot "%cloudserviceslot%" -package "%packageurl%" -configuration "%cscfgfilename%" -label "%deploymentlabel%" -servicename "%cloudservicename%" $completedeployment = get-azuredeployment -servicename "%cloudservicename%" -slot "%cloudserviceslot%" $completedeploymentid = $completedeployment.deploymentid write-progress -id 3 -activity "creating new deployment" -completed -status "complete" write-output "$(get-date -f g) - creating new deployment: complete, deployment id: $completedeploymentid" } function upgradedeployment() { write-progress -id 3 -activity "upgrading deployment" -status "in progress" write-output "$(get-date -f g) - upgrading deployment: in progress" $opstat = set-azuredeployment -upgrade -slot "%cloudserviceslot%" -package "%packageurl%" -configuration "%cscfgfilename%" -label "%deploymentlabel%" -servicename "%cloudservicename%" -force $completedeployment = get-azuredeployment -servicename "%cloudservicename%" -slot "%cloudserviceslot%" $completedeploymentid = $completedeployment.deploymentid write-progress -id 3 -activity "upgrading deployment" -completed -status "complete" write-output "$(get-date -f g) - upgrading deployment: complete, deployment id: $completedeploymentid" } write-output "$(get-date -f g) - create azure deployment" publish

the values in %% replaced teamcity parameter values, fine. when run commands computer using same settings , same publishsettings-file, works. teamcity build agent, not. not work powershell console on teamcity build agent machine.

log says (replaced id, name etc. ***):

[22:45:47] : [step 2/2] ##teamcity[buildstatisticvalue key='buildstageduration:buildsteprunner_193' value='0.0'] [22:45:47] : [step 2/2] starting: c:\windows\syswow64\windowspowershell\v1.0\powershell.exe -noprofile -noninteractive -executionpolicy bypass -command - < e:\buildagent1\temp\buildtmp\powershell2886801367807761703.ps1 [22:45:47] : [step 2/2] in directory: e:\buildagent1\work\a355cf3c0001cfa2 [22:45:49] : [step 2/2] 13.11.2014 22:45 - running azure imports [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] id : *** [22:45:50] : [step 2/2] name : *** [22:45:50] : [step 2/2] environment : azurecloud [22:45:50] : [step 2/2] business relationship : *** [22:45:50] : [step 2/2] properties : {[supportedmodes, azureservicemanagement]} [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] id : *** [22:45:50] : [step 2/2] name : *** [22:45:50] : [step 2/2] environment : azurecloud [22:45:50] : [step 2/2] business relationship : *** [22:45:50] : [step 2/2] properties : {[supportedmodes, azureservicemanagement], [default, true], [22:45:50] : [step 2/2] [storageaccount, ***]} [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] [22:45:50] : [step 2/2] 13.11.2014 22:45 - create azure deployment [22:45:52]w: [step 2/2] get-azuredeployment : error occurred while sending request. [22:45:52]w: [step 2/2] in zeile:2 zeichen:16 [22:45:52]w: [step 2/2] + $deployment = get-azuredeployment -servicename "***" -slot [22:45:52]w: [step 2/2] "production" ... [22:45:52]w: [step 2/2] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [22:45:52]w: [step 2/2] ~~~ [22:45:52]w: [step 2/2] + categoryinfo : notspecified: (:) [get-azuredeployment], httpreq [22:45:52]w: [step 2/2] uestexception [22:45:52]w: [step 2/2] + fullyqualifiederrorid : system.net.http.httprequestexception,microsoft.w [22:45:52]w: [step 2/2] indowsazure.commands.servicemanagement.hostedservices.getazuredeploymentco [22:45:52]w: [step 2/2] mmand [22:45:52]w: [step 2/2] [22:45:52] : [step 2/2] 13.11.2014 22:45 - no deployment detected. creating new deployment. [22:45:52] : [step 2/2] 13.11.2014 22:45 - creating new deployment: in progress [22:45:53]w: [step 2/2] new-azuredeployment : error occurred while sending request. [22:45:53]w: [step 2/2] in zeile:5 zeichen:15 [22:45:53]w: [step 2/2] + $opstat = new-azuredeployment -slot "production" -package [22:45:53]w: [step 2/2] "http://*** ... [22:45:53]w: [step 2/2] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [22:45:53]w: [step 2/2] ~~~ [22:45:53]w: [step 2/2] + categoryinfo : notspecified: (:) [new-azuredeployment], httpreq [22:45:53]w: [step 2/2] uestexception [22:45:53]w: [step 2/2] + fullyqualifiederrorid : system.net.http.httprequestexception,microsoft.w [22:45:53]w: [step 2/2] indowsazure.commands.servicemanagement.hostedservices.newazuredeploymentco [22:45:53]w: [step 2/2] mmand [22:45:53]w: [step 2/2] [22:45:54]w: [step 2/2] get-azuredeployment : error occurred while sending request. [22:45:54]w: [step 2/2] in zeile:6 zeichen:27 [22:45:54]w: [step 2/2] + $completedeployment = get-azuredeployment -servicename "***" [22:45:54]w: [step 2/2] -slot " ... [22:45:54]w: [step 2/2] + [22:45:54]w: [step 2/2] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [22:45:54]w: [step 2/2] + categoryinfo : notspecified: (:) [get-azuredeployment], httpreq [22:45:54]w: [step 2/2] uestexception [22:45:54]w: [step 2/2] + fullyqualifiederrorid : system.net.http.httprequestexception,microsoft.w [22:45:54]w: [step 2/2] indowsazure.commands.servicemanagement.hostedservices.getazuredeploymentco [22:45:54]w: [step 2/2] mmand [22:45:54]w: [step 2/2] [22:45:54] : [step 2/2] 13.11.2014 22:45 - creating new deployment: complete, deployment id: [22:45:54] : [step 2/2] process exited code 0 [22:45:54] : [step 2/2] ##teamcity[buildstatisticvalue key='buildstageduration:buildsteprunner_193' value='7118.0']

i wondering exception. publishsettings file valid, certificate valid , works fine using visual studio or cerebrata azure management studio. powershell deployment fails.

any ideas?

solved downgrading azure powershell previous version. looks oct 2014 release has bug here.

powershell azure teamcity

No comments:

Post a Comment