Azure DevOps Powershell script Could not create SSL/TLS secure channel - azure

Problem:
If I call command Get-AzureDeployment(also Get-AzureService) from 'Azure Powershell' task in DevOps Pipeline I am getting: 'The request was aborted: Could not create SSL/TLS secure channel.'
Introduction:
I use Azure DevOps to deploy Azure Cloud service (classic) into Azure
The 'Azure Powershell' task was working the whole time but then without changing anything it stopped working
I have also imported the certificate(used by DevOps) into my pc (by Import-AzurePublishSettingsFile) and tried to run the same powershell script and everytnig works fine so I expect problem in DevOps
DevOps connection:
I have created 'Service connection' in Azure DevOps to connect into Azure
The Service
connection is type of 'Azure Classic' (because 'Azure Resource Manager' is not for 'Cloud service classic')
Autentication method of the
'Azure Classic service connection' is 'Certificate based'.
I used
certificate generated by 'Publish Settings File' for my azure
subscription. The certificate was placed by azure into
My-subscription->Management certificates (expiration date is in mid
2021)
I use this service connection for deploying app (Cloud service classic) into Azure with no problem (by DevOps task 'Azure Cloud Service deployment') but just the 'Azure Powershell' task start failing.
This all was working for 3 months and then stopped working for any reason.
The weird thing is that when I was playing with DevOps to find out what is wrong the task was once successfully run, but when I tried that again I got the error again.
I have both logs, from sucessful call and failing call. 2506 lines of logs are identical and the change is after this line.
I can send you both full logs but I don't want to place here so long logs.
Successful try:
VERBOSE: 8:31:40 AM - Begin Operation: Get-AzureDeployment
VERBOSE: 8:31:42 AM - Completed Operation: Get-AzureDeployment
... some other info about the deployment in slot
Log from failing call:
VERBOSE: 9:53:39 AM - Begin Operation: Get-AzureDeployment
##[debug]Caught exception from task script.
##[debug]Error record:
##[debug]Get-AzureDeployment : An error occurred while sending the request.
##[debug]At D:\a\r1\a\_Tools\Powershell\cloud-service_swap-slot.ps1:14 char:15
##[debug]+ ... eployment = Get-AzureDeployment -Slot "Staging" -ServiceName $CloudSe ...
##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##[debug] + CategoryInfo : CloseError: (:) [Get-AzureDeployment], HttpRequestException
##[debug] + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureDeploymentComma nd
##[debug]
##[debug]Script stack trace:
##[debug]at <ScriptBlock>, D:\a\r1\a\_Tools\Powershell\cloud-service_swap-slot.ps1: line 14
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]at <ScriptBlock>, D:\a\_tasks\AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62\3.171.2\AzurePowerShell.ps1: line 145
##[debug]at <ScriptBlock>, D:\a\_tasks\AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62\3.171.2\AzurePowerShell.ps1: line 141
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]at <ScriptBlock>, <No file>: line 22
##[debug]at <ScriptBlock>, <No file>: line 18
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]Exception:
##[debug]System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
##[debug] at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
##[debug] at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
##[debug] --- End of inner exception stack trace ---
##[debug] at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
##[debug] at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
##[debug] at Microsoft.WindowsAzure.Management.Compute.DeploymentOperationsExtensions.GetBySlot(IDeploymentOperations operations, String serviceName, DeploymentSlot deploymentSlot)
##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.ServiceManagementBaseCmdlet.ExecuteClientActionNewSM[TResult](Object input, String operationDescription, Func`1 action, Func`3 contextFactory)
##[error]An error occurred while sending the request.
##[debug]Processed: ##vso[task.logissue type=error]An error occurred while sending the request.
##[debug]Processed: ##vso[task.complete result=Failed]
In both logs I can also find this for adding Azure account into Powershell:
##[debug]Added certificate to the certificate store.
##[command]Set-AzureSubscription -SubscriptionName PXX -SubscriptionId XXXXXX01-09f5-4703-bcc9-6ff914XXXXXX -Certificate ******** -Environment AzureCloud
##[command]Select-AzureSubscription -SubscriptionId XXXXXX01-09f5-4703-bcc9-6ff914XXXXXX
##[debug]Leaving Initialize-Azure.
## Initializing Azure Complete
(I have replaced some strings with X)
There is the Powershell task in YAML:
steps:
- task: AzurePowerShell#3
displayName: 'Swap slots'
inputs:
azureConnectionType: ConnectedServiceName
azureClassicSubscription: 'PXX subscription'
ScriptPath: '$(System.DefaultWorkingDirectory)/_Tools/Powershell/cloud-service_swap-slot.ps1'
ScriptArguments: '-CloudServiceName $(CloudServiceName)'
FailOnStandardError: true
azurePowerShellVersion: LatestVersion
And the Powershell script for swapping slots that works from local pc (with the same cert) but failing in DevOps:
[CmdletBinding(PositionalBinding=$True)]
Param(
[Parameter(Mandatory = $true)]
[String]$CloudServiceName # required
)
# Check if Windows Azure Powershell is avaiable
if ((Get-Module -ListAvailable Azure) -eq $null)
{
throw "Windows Azure Powershell not found! Please install from http://www.windowsazure.com/en-us/downloads/#cmd-line-tools"
}
# VIP Swap
$Deployment = Get-AzureDeployment -Slot "Staging" -ServiceName $CloudServiceName #It's failing here
if ($Deployment -ne $null -AND $Deployment.DeploymentId -ne $null)
{
Write-Output ("Current Status of staging in {0}" -f $CloudServiceName);
Write-Host ($Deployment | Select-Object -Property * -ExcludeProperty Configuration,RolesConfiguration | Format-List | Out-String);
$MoveStatus = Move-AzureDeployment -ServiceName $CloudServiceName
Write-Output ("Vip swap of {0} status: {1}" -f $CloudServiceName, $MoveStatus.OperationStatus)
}else
{
Write-Output ("There is no deployment in staging slot of {0} to swap." -f $CloudServiceName)
}
Does anyone the same experience like me? Where could be the problem?
# Update
I have tried to add this security protocol setting at the begining of the script but with the same error.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

This appears to be an issue with the Microsoft build agents, but adding the following code to the beginning of each Azure Powershell task seems to have resolved this for us until they can figure that out.
$pcert = (Get-Variable Endpoint -ValueOnly).Auth.Parameters.certificate
$bytes = [convert]::FromBase64String($pcert)
[IO.File]::WriteAllBytes("C:\cert.pfx",$bytes)
$null = Import-PfxCertificate -FilePath C:\cert.pfx -CertStoreLocation cert:\CurrentUser\My

There are few workarounds which are working.
Workaround 1
Use Azure Powershell Task Version 5
Select "Azure Resource Manager Connection"
Change ASM Module commands to Az commands
Workaround 2
Use Azure Powershell Task Version 3
Classic Connection
Downgrade Azure Powershell Version to 4.2.1
Workaround 3 (for private agents)
Create a self-signed cert in your CurrentUser\My store. you can find details on creating a self-signed cert here: https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-certs-create
Export the public key for the cert as a DER-encoded CER file (you can use mmc or any other cert tool for this)
Upload the .Cer file as a management certificate through the portal: https://learn.microsoft.com/en-us/previous-versions/azure/azure-api-management-certs
Authenticate using Set-AzureSubscription:
PS C:\> Clear-AzureProfile
PS C:\> $cert = Get-Item Cert:\CurrentUser\My\
PS C:\ > Set-AzureSubscription -SubscriptionName "" -SubscriptionId -Certificate $cert
PS C:\> Select-AzureSubscription -SubscriptionId
Workaround 4
Add below script to each Azure Powershell task
$p = (Get-Variable Endpoint -ValueOnly).Auth.Parameters.certificate
$bytes = [convert]::FromBase64String($p)
[IO.File]::WriteAllBytes("C:\cert.pfx",$bytes)
Import-PfxCertificate -FilePath C:\cert.pfx -CertStoreLocation cert:\CurrentUser\My
.
.
actual script
.
.
#remove certificate from store
$thumb = (Get-PfxData -FilePath "C:\cert.pfx").EndEntityCertificates.Thumbprint
Remove-Item -Path cert:\CurrentUser\My\$thumb -recurse -Force

We had the same issue. It only manifested on windows-2019 agents, not vs2017-win2016.
So you could fix it by changing the agent type, but a better fix is to use a specific Powershell version of 5.1.1 instead of latest. It seems that latest recently increased to 5.3.0 which causes this error.

I have the same issue and tried all these, for me it worked only if I added this after the Initialize-Azure part: "Set-AzureSubscription -SubscriptionId [my subscription id] -CurrentStorageAccountName [storage name]"

This issue is caused by a change of behavior introduced with the .NET September update. The following code will restore implicit storage of keys (the previous .Net 4.x behavior) through an environment variable:
Set-Item env:\COMPLUS_CngImplicitPersistKeySet 1
NOTE: You will then need to create a new publishsettings file, as the old certificate and keys will not be overwritten by a subsequent import.

Downgrading the Az Powershell version to 4.2.1 works using the AzurePowerShell#3 task.

In my case I had this problem in a Get-AzureServiceRemoteDesktopExtension command in a "Run Inline Azure Powershell" task on our on-premises Team Foundation Server 2017.
I tried adding the line #damien-caro suggested here ...
Set-Item env:\COMPLUS_CngImplicitPersistKeySet 1
... to my script, but that only solved the problem for a single release. All subsequent releases/deploys failed with Could not create SSL/TLS secure channel once more.
Simply adding it as a variable to the release definition did solve the problem. (To test it I have successfully deployed the same release to two environments, three times in a row.)
I found this solution here: https://github.com/Azure/azure-powershell/issues/13117#issuecomment-706665722

In my case I had accidentally mentioned https instead of http. My report server was http, without cert, but it used to redirect in browser even if I type https internally in our organization. But powershell needs the exact url. The version I used was powershell#2 and I invoked a powershell script file.

Related

Azure powershell Move-AzureDeployment - error: HttpRequestException

We have a Cloud Service (Classic) swap using powershell in Azure pipelines that has worked all year, setup by a previous employee and now it is failing with error:
Move-AzureDeployment : An error occurred while sending the request.
At D:\a\_temp\blahblahblah.ps1:8 char:1
+ Move-AzureDeployment -ServiceName $servicename
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Move-AzureDeployment], HttpRequestException
+ FullyQualifiedErrorId : System.Net.Http.HttpRequestException,Microsoft.WindowsAzure.Commands.ServiceManagement.H
ostedServices.MoveAzureDeploymentCommand
The actual job task is using PowerShell Script set as inline with Error action as Stop. The actual script:
$subid = 'blah-blah-blah-blah'
$servicename = "blahblahblah"
Select-AzureSubscription -SubscriptionId $subid
Move-AzureDeployment -ServiceName $servicename
$service = Get-AzureDeployment -ServiceName $servicename -Slot Production
Start-Sleep -s 300
Remove-AzureDeployment -ServiceName $servicename -Slot "Staging" -Force
I was sure this was maybe a Service connection with Management Certificate expired but I have one valid working and found it is setup exactly like another similar pipeline/service connection that is working.
So the issue was two things, SSL and PowerShell version issues after updates. To deal with SSL issues I added this line to the top of our inline script:
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
And for the PowerShell issue it required changing to the Azure PowerShell app for pipelines, so we could roll back to a specific task version and the 4.2.1 PowerShell Version as seen in this answer:
Programmatically Swap Staging Slot to Production Slot in Azure Cloud Service
This might be the only way to swap a Cloud Service (Classic) these days. A little annoying Azure pushed this classic service and never properly maintained it.

Azure DevOps pipeline: Azure Copy Files step V4 error - can't find the specified folder

I am tying to deploy static version of storybook to Azure Cloud Storage blob container using Azure DevOps pipeline.
Since the image is sometimes more descriptive:
The SourcePath (or Source in image above) needs to be an absolute path to file/folder you want to copy to blob.
I referred to:
https://github.com/microsoft/azure-pipelines-tasks/edit/master/Tasks/AzureFileCopyV4/README.md
https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?tabs=yaml&view=azure-devops
and various other sources.
No matter what predefined variable I try to use, I always see the same error:
failed to perform copy command due to error: cannot start job due to error: cannot scan the path \\?\D:\a\1\dist-storybook, please verify that it is a valid.
And this is what I tried so far:
- task: AzureFileCopy#4
inputs:
# SourcePath: '$(Build.Repository.LocalPath)/dist-storybook'
# SourcePath: '$(Build.SourcesDirectory)/dist-storybook'
SourcePath: '$(Agent.BuildDirectory)/dist-storybook'
# SourcePath: '$(System.DefaultWorkingDirectory)/dist-storybook'
azureSubscription: 'xxx'
Destination: 'AzureBlob'
storage: 'xxx'
ContainerName: 'storybook'
Before you go with the comments to check if dist-storybook folder exists and whether I verified.
Yes it exists. Before I tried Azure File Copy v4 task I was using AzureRmWebAppDeployment task with this param: packageForLinux: '$(System.DefaultWorkingDirectory)/dist-storybook' (which deploys to Azure App Service [but in case of Storybook it's an overkill, because generated Storybook consists of static files and doesn't require the server to run]) and it was deploying Storybook successfully. So the dist-storybook is properly generated in previous step in the pipeline.
Anyone has any clues?
UPDATE:
After receiving some help on Microsoft Developer Forum:
https://developercommunity.visualstudio.com/content/problem/1203833/azure-file-copy-source-requires-absolute-path.html
I started using v3 (AzureFileCopy#3) of the task with the $(Build.Repository.LocalPath) predefined system variable (which I already used unsuccessfully with v4 [AzureFileCopy#4])
This is the full task:
- task: AzureFileCopy#3
inputs:
SourcePath: '$(Build.Repository.LocalPath)/dist-storybook/*'
azureSubscription: 'xxx'
Destination: 'AzureBlob'
storage: 'xxx'
ContainerName: 'storybook'
Now I get this error:
2020-09-30T09:19:03.1646485Z ##[section]Starting: AzureFileCopy
2020-09-30T09:19:03.1870156Z ==============================================================================
2020-09-30T09:19:03.1871285Z Task : Azure file copy
2020-09-30T09:19:03.1872336Z Description : Copy files to Azure Blob Storage or virtual machines
2020-09-30T09:19:03.1873312Z Version : 3.175.2
2020-09-30T09:19:03.1874422Z Author : Microsoft Corporation
2020-09-30T09:19:03.1876194Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2020-09-30T09:19:03.1877411Z ==============================================================================
2020-09-30T09:19:06.0053519Z ##[command]Import-Module -Name C:\modules\azurerm_6.13.1\AzureRM\6.13.1\AzureRM.psd1 -Global
2020-09-30T09:19:29.9367823Z ##[command]Clear-AzureRmContext -Scope Process
2020-09-30T09:19:31.1812482Z ##[command]Clear-AzureRmContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
2020-09-30T09:19:32.3448727Z ##[command]Add-AzureRMAccount -ServicePrincipal -Tenant *** -Credential System.Management.Automation.PSCredential -Environment AzureCloud
2020-09-30T09:19:34.2134374Z ##[command] Set-AzureRmContext -SubscriptionId 5a6f9ac1-3fc5-4ecc-9909-7c1f7be55b1f -TenantId ***
2020-09-30T09:19:41.8630229Z Uploading files from source path: 'D:\a\1\s\dist-storybook\*' to storage account: 'stdesignsystemdevuksouth' in container: 'storybook' with blob prefix: ''
2020-09-30T09:19:41.9074144Z ##[command] & "AzCopy\AzCopy.exe" /Source:"D:\a\1\s\dist-storybook\*" /Dest:"https://stdesignsystemdevuksouth.blob.core.windows.net/storybook" /#:"D:\a\_temp\9a9dd952-202a-4851-91ed-e27a062f8f4a" /XO /Y /SetContentType /Z:"AzCopy" /V:"AzCopy\AzCopyVerbose_a1f6be33-1856-4036-98e1-d6c9c5a151af.log" /S
2020-09-30T09:19:42.8784330Z [2020/09/30 09:19:42][ERROR] Error parsing source location "D:\a\1\s\dist-storybook\*": Failed to enumerate directory D:\a\1\s\dist-storybook\*\ with file pattern *. The system cannot find the path specified. (Exception from HRESULT: 0x80070003) For more details, please type "AzCopy /?:Source" or use verbose option /V.
2020-09-30T09:19:43.1065203Z ##[command]Disconnect-AzureRmAccount -Scope Process -ErrorAction Stop
2020-09-30T09:19:43.9220995Z ##[command]Clear-AzureRmContext -Scope Process -ErrorAction Stop
2020-09-30T09:19:44.4426511Z ##[error]Upload to container: 'storybook' in storage account: 'stdesignsystemdevuksouth' with blob prefix: '' failed with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme
2020-09-30T09:19:44.5187191Z ##[section]Finishing: AzureFileCopy

Deploy Azure Cloud Service from Visual Studio Online

Can we setup Azure Cloud Service deployment as a part of the build process to have a similar result that Visual Studio wizard gives?
UPD. We found "Azure Cloud Service Deployment" build step, but it fails with following unexpected error (because storage account is set actually, see the full log below).
CurrentStorageAccountName is not set. Use Set-AzureSubscription
subname -CurrentStorageAccountName storageaccount to set it.
The full log:
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.
We finally succeeded with "Azure PowerShell" generic build step and the custom PS script that uses Azure API to create/update Azure deployment (New-AzureDeployment, Set-AzureDeployment).
The great article that contains the full script is here: http://www.kenneth-truyers.net/2014/02/06/deploying-cloud-services-to-azure-with-powershell/.
You need to setup and login to the subscription before you try any commands.
I usually make it part of my PowerShell, and if you search around you can find out how to encrypt your credentials to not have them in the script.

Calling Set-AzureServiceDiagnosticsExtension with Role parameter fails

I'm trying to set Azure diagnostics on a deployed cloud service using the Azure Powershell cmdlets and the Set-AzureServiceDiagnosticsExtension command:
Set-AzureServiceDiagnosticsExtension -StorageContext $storageContext -DiagnosticsConfigurationPath $diagnosticsConfiguration.FullName -ServiceName $serviceName -Slot Production -Role "MyService.Web"-Verbose
Doing so I get the following error
Exception: Microsoft.WindowsAzure.CloudException: BadRequest: The extension ID
MyService.Web-PaaSDiagnostics-Production-Ext-0 is invalid.
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task
task)
at Microsoft.WindowsAzure.HostedServiceOperationsExtensions.AddExtension(IHo
stedServiceOperations operations, String serviceName,
HostedServiceAddExtensionParameters parameters)
at Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.ExtensionMan
ager.AddExtension(HostedServiceAddExtensionParameters extensionInput)
at Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.ExtensionMan
ager.InstallExtension(ExtensionConfigurationInput context, String slot,
ExtensionConfiguration extConfig)
at Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.SetAzureServ
iceDiagnosticsExtensionCommand.ExecuteCommand()
at Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.SetAzureServ
iceDiagnosticsExtensionCommand.OnProcessRecord()
at Microsoft.WindowsAzure.Commands.Utilities.Common.CloudBaseCmdlet`1.Proces
sRecord()
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,UpdateDiagnosticsBuildStep.ps1
It works when I don't use the "-Role" parameter but then I have to call Remove-AzureServiceDiagnosticsExtension for each role prior to calling the Set command which adds 2-3 minutes per role to the script execution time.
The Role parameter matches my role name in the Azure Cloud Service. Am I doing something wrong?
This doesn't like . in the Role name
Change to underscore and it will work
Its a bug in powershell that they will fix next time

Publish-AzureServiceProject command failed for node.js application

I am following this tutorial to deploy node.js application from my machine to windows azure:
https://www.windowsazure.com/en-us/develop/nodejs/tutorials/getting-started/
my command is as below:
Publish-AzureServiceProject -ServiceName socketlistener -Location "East US" -Launch
but I am getting the following error
Publishing to Windows Azure. This may take several minutes...
1:32:36 PM - Preparing runtime deployment for service 'socketlistener'
1:32:38 PM - Preparing deployment for socketlistener with Subscription ID: ***...
1:32:40 PM - Verifying storage account 'socketlistener'...
Publish-AzureService : Path for package doesn't exist in D:\dev\node\socketlistener\cloud_package.cspkg.
At line:1 char:21
Publish-AzureService <<<<
CategoryInfo : CloseError: (:) [Publish-AzureService], FileNotFoundException
What I am suspecting is that there is some issue with your application configuration (Service Definition or Service Configuration) which is causing problem in package creation. The error message also suggests the same problem. Based on Publish-AzureServiceProject command execution the next step is to create the package after verifying the storage account. And after the package creation, the next step is to connect service endpoint which you can verify in the same link above you are following in tutorial.
To verify that there is no issue with your machine or connection to Windows Azure application, try creating a new Node.js application, add new web/worker role and do not make any changes in configuration then try deploying. This will verify if there is any issue with your machine configuration (if any) or other issue:
New-AzureServiceProject your_node_project
Add-AzureNodeWebRole
Publish-AzureServiceProject -ServiceName socketlistener -Location "East US" -Launch

Resources