Parameters not being passed into DeployToAzure.ps1

Hi,

I’m using a “Deploy to Windows Azure” process to deploy a nuget package to Azure using Octopus Deploy 2.3.3.1369. The form within the step has been completed with all the required values and they appear to be correct. All the “Enabled features” boxes are unticked.

When I deploy the release, it looks as if a variable is missing from the script; it is being passed through as a null. Below is the log, tell me what you think:

Deploy xxxxx Website release 1.0.0.1722 to xxxxx Website Prod
Acquire packages
Step 1: Deploy to Azure South East Asia
Executing step: Deploy to Azure South East Asia
Running "Deploy to Azure South East Asia" on "Octopus Server"
Deploy xxxxxCloud on Octopus Server
Beginning deployment...

Error running conventions; running failure conventions...
Deployment on the Tentacle failed.

Update ServiceConfiguration.Cloud.cscfg
No settings that match provided variables were found.

Upload xxxxxCloud.cspkg
Uploading package to Azure blob storage: C:\Octopus\Applications\xxxxx Website Prod\xxxxxCloud\1.0.0.172_5\xxxxxCloud.cspkg

Deploy to Azure
Azure deployment parameters: 
  Subscription ID:       xxxxxxxx-xxxx-xxxx-a2f3-c6e387dc4e99
  Subscription name:     xxxxxxxx-xxxx-xxxx-xxxx-fc18bb5aed96
  Cloud service name:    xxxxx
  Storage account name:  xxxxxwebsites
  Slot:                  Staging
  Package URI:           
  Configuration file:    C:\Octopus\Applications\xxxxx Website Prod\xxxxxCloud\1.0.0.172_5\ServiceConfiguration.Cloud.cscfg
  Deployment label:      Deploy to Azure South East Asia v1.0.0.1722
  Allow swap:            False
Importing Windows Azure modules
Loading the management certificate
Setting up the Azure subscription
Starting the Azure deployment process
Creating a new deployment...
WARNING: The current subscription is being removed. Use Select-Subscription 
<subscriptionName> to select a new current subscription.
New-AzureDeployment : Cannot validate argument on parameter 'Package'. The 
argument is null or empty. Supply an argument that is not null or empty and 
then try the command again.
At C:\Octopus\Applications\xxxxx Website 
Prod\xxxxxCloud\1.0.0.172_5\DeployToAzure.ps1:73 char:58
+     New-AzureDeployment -Slot $OctopusAzureSlot -Package 
$OctopusAzurePackageUri ...
+                                                          
~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [New-AzureDeployment], ParentCo 
   ntainsErrorRecordException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Windo 
   wsAzure.Management.ServiceManagement.HostedServices.NewAzureDeploymentComm  
  and
PowerShell script returned a non-zero exit code: 1

When I experimented with the scripts from github, I found that the parameters the script said would be passed to it, were not being passed. For example:

The script will be passed the following parameters in addition to the normal Octopus

variables passed to any PowerShell script.

$OctopusAzureSubscriptionId

$OctopusAzureSubscriptionName

$OctopusAzureServiceName

$OctopusAzureStorageAccountName

$OctopusAzureSlot

$OctopusAzurePackageUri

$OctopusAzureConfigurationFile

$OctopusAzureDeploymentLabel

$OctopusAzureSwapIfPossible

So I found that $OctopusAzurePackageUri was null, which makes sense if you look at the error I am getting above.

I cannot however figure out WHY these parameters are not being passed from the “Deploy to Windows Azure” process step. Any help would be very much appreciated.

Cheers,

Brendan

Hi Brendan,

What version of Octopus 2.0 are you using?

Paul

Hey Paul! As above, Octopus Deploy 2.3.3.1369.

Thanks.

Hi Brendan,

Sorry, I should have read the original post properly. It looks like we attempt to upload the package but then there’s no package URI provided as you discovered. Can you attach/send me the full deployment log? You can get it this way:

Paul

Hey Paul,

Sure thing. Clicking the link provided takes me to a login form?
Do you have a confidential method I can send the log to you?

Thanks,
Brendan

Hi Brendan,

You can email it to me - paul at octopusdeploy.com

Paul

Sorry Brendan, I’ve fixed the link now:

Paul

Thanks Paul, sent.

Any thoughts Paul?

Hi Brendan, sorry for the delay, I’ve been on the road. I’m just looking into this right now and will get back to you within the hour.

Paul

Hi Brendan,

In your log we see:

                    |       Success: Upload XYZCloud.cspkg
16:43:23   Info     |         Uploading package to Azure blob storage: C:\Octopus\Applications\XYZ Website Prod\XYZCloud\1.0.0.172_6\XYZCloud.cspkg
16:43:23   Verbose  |         Connecting to Azure blob storage

It says that it is connecting to Azure blob storage, and then that’s it. It doesn’t log an error, or the usual message to say it completed.

It turns out there was a bug in 2.3.3 where failures in some tasks didn’t get logged, and didn’t cause the next step to fail. We fixed this last week in 2.3.4:

Can you try upgrading to 2.3.4? It should allow you to see the error message being retuned from the attempt to upload the package.

I’m sorry for the problem, I’m sure it would have been easier for you to rectify if we had logged the error.

Paul

Thanks, I’ve asked our resident Octopus upgrade expert to give it a spin. :slight_smile:

Hi all,

Did we manage to find a resolution to this?

I’m seeing a similar problem with a deployment to Azure. I have upgraded to 2.4.5.46 and seeing the following in the deployment log:

@@@
09:48:16 Info | Uploading package to Azure blob storage: C:\Octopus\Applications\Staging\Portal.Azure\1.0.95\Portal.Azure.ccproj.cspkg
09:48:16 Verbose | Connecting to Azure blob storage
|
| Failed: Deploy to Azure
09:48:20 Info | Azure deployment parameters:
09:48:20 Info | Subscription ID: b079ebbb-6532-XXXXXXXXXXXX
09:48:20 Info | Subscription name: 7b4e3813-ed82-XXXXXXXXXXXXX
09:48:20 Info | Cloud service name: XXXXX-test
09:48:20 Info | Storage account name: XXXXXX-test
09:48:20 Info | Slot: staging
09:48:20 Info | Package URI:
09:48:20 Info | Configuration file: C:\Octopus\Applications\Staging\Portal.Azure\1.0.95\ServiceConfiguration.Cloud.cscfg
09:48:20 Info | Deployment label: Azure Deploy v1.0.95.8
09:48:20 Info | Allow swap: False
09:48:20 Info | Importing Windows Azure modules
09:48:21 Info | Loading the management certificate
09:48:21 Info | Setting up the Azure subscription
09:48:22 Info | Starting the Azure deployment process
09:48:24 Info | Creating a new deployment…
09:48:25 Info | WARNING: The default subscription is being removed. Use Select-Subscription
09:48:25 Info | to select a new default subscription.
09:48:25 Info | WARNING: The current subscription is being removed. Use Select-Subscription
09:48:25 Info | to select a new current subscription.
09:48:25 Error | New-AzureDeployment : Cannot validate argument on parameter ‘Package’. The
09:48:25 Error | argument is null or empty. Provide an argument that is not null or empty, and
09:48:25 Error | then try the command again.
09:48:25 Error | At C:\Octopus\Applications\Staging\Portal.Azure\1.0.95\DeployToAzure.ps1:73
09:48:25 Error | char:58
09:48:25 Error | + New-AzureDeployment -Slot $OctopusAzureSlot -Package
09:48:25 Error | $OctopusAzurePackageUri …
09:48:25 Error | +
09:48:25 Error | ~~~~~~~~~~~~~~~~~~~~~~~
09:48:25 Error | + CategoryInfo : InvalidData: (:slight_smile: [New-AzureDeployment], ParentCo
09:48:25 Error | ntainsErrorRecordException
09:48:25 Error | + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Windo
09:48:25 Error | wsAzure.Management.ServiceManagement.HostedServices.NewAzureDeploymentComm
09:48:25 Error | and
09:48:25 Fatal | PowerShell script returned a non-zero exit code: 1
@@@

Any help would be really appreciated.

Sam

To overcome the bug I experienced, the solution was to upgrade to a newer version. :slight_smile: