Publish-AzureServiceProject command failed for node.js application - node.js

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

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.

Why can't AzureRmAks find SSH key when deploying new Kubernetes cluster?

Last night I used PowerShell to deploy a Kubernetes cluster on AKS with something like this:
New-AzureRmAks -ResourceGroupName "my-rg" -Name "my-aks-cluster" -KubernetesVersion "1.16.13" -NodeCount 2 -NodeVmSize "Standard_DS2_V2" -Verbose
This worked fine. Today, however, I tried this same thing in a different subscription, but keep getting the following error:
VERBOSE: Cluster does not exist.
VERBOSE: Cluster is new.
VERBOSE: Performing the operation "Creating a managed Kubernetes cluster." on target "my-aks-cluster in my-rg".
VERBOSE: Preparing for deployment of your managed Kubernetes cluster.
VERBOSE: Using location eastus from the resource group my-rg.
VERBOSE: Using DNS name prefix my-aks-cluster-my-rg-dcdf2a.
VERBOSE: Fetching SSH public key from file C:\Users\myuser\.ssh\id_rsa.pub
New-AzureRmAks : The given key was not present in the dictionary.
At line:1 char:1
+ New-AzureRmAks -ResourceGroupName "my-reg" -Name "my-aks-cluster" -Kube ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmAks], KeyNotFoundException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Aks.NewAzureRmAks
I'm confused because:
This same command worked earlier
I have same admin rights to new subscription as to the one previously used
The path to the key is valid
The key, id_rsa.pub, is at the path listed
Anyone have an idea what is going on here? Any tips are appreciated.
I can reproduce this issue with the same user account when only changing to a new subscription in another directory.
To fix it, you can delete all files but leave TokenCache.dat file in the .Azure folder of the path
C:\Users\myuser\.Azure
Then re-connect the subscription.
Edit
In this case, deleting the file acsServicePrincipal under the local .azure directory is to fix this issue.

Publish-AzWebApp throwing an aggregate exception, need to understand why/ how to debug

I am currently building a powershell script which creates 2 web app services in azure and then publishes the apps. The first app, which is a react app, publishes. The backend, built using node.js, throws an aggregate exception. I dont't know what to do with this or how to debug it.
I have tried isolating the second publish command to see if anything is interfering with it, but it still throws the same error.
Publish-AzWebApp -ResourceGroupName $resourcegroup -Name frontend$webappname -ArchivePath "C:\Users\Charles\Desktop\Timesheet App\Discover\DiscoverBuild.zip"
Publish-AzWebApp -ResourceGroupName $linuxresourcegroup -Name backend$webappname -ArchivePath "C:\Users\Charles\Desktop\Timesheet App\Discover\SNAP.zip"
Expect the app to publish ok, instead receive the following error:
Publish-AzWebApp : One or more errors occurred.
At C:\Users\Charles\Desktop\Timesheet App\Discover\deployScript.ps1:127 char:1
+ Publish-AzWebApp -ResourceGroupName $linuxresourcegroup -Name backend ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Publish-AzWebApp], AggregateException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps.PublishAzureWebAppCmdlet
Problem was caused by a setting being wrong when the app service was created. When the app service is created I needed to set "clientAffinityEnabled": true. I did this in an arm template but you can probably change the settings in antoher way.
You could check the application log to debug.
Navigate to the App Service logs in your web app in the portal -> select the Application Logging with File System.
Then run your command again, after a while, navigate to Log stream -> check the log.

azure automation: 'Invoke-ProcessASDatabase' is not recognized

I am trying to use runbook in Azure automation account to process Azure Analysis Service cube.
I followed Microsoft blog https://learn.microsoft.com/en-us/azure/automation/automation-runbook-gallery.
However I got following error message when testing it. My runbook script is as following: Can you please help?
Runbook Script:
$SPCredential = Get-AutomationPSCredential -Name "TestCred"
$null = Invoke-ProcessASDatabase -databasename "SalesCube" -server "asazure://xx" -RefreshType "Full" -Credential $SPCredential
Write-Output "Done"
error message:
Invoke-ProcessASDatabase : The term 'Invoke-ProcessASDatabase' is not
recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:5 char:9
+ $null = Invoke-ProcessASDatabase -databasename "SalesCube" -ser ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-ProcessASDatabase:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Thank you for reporting this issue. We reported this thread to Microsoft this morning.
The following answer is coming from a Microsoft Azure manager:
An issue has been identified with the .Net version for Azure
Automation sandboxes that released a lower version then what was used
previously. An update is rolling out to support .Net 4.6 that should
resolve issues with PowerShell modules depending on a version on or
above .Net 4.5. It is currently planned to be rolled out to all
regions by next Monday (the 5th).
Hope this helps.
This appears to be an issue with Azure Automation this morning. I have a runbook that has completed successfully for weeks and today it failed with the same error message the OP reported. I've opened a support ticket with MS. If it is a widespread problem, perhaps they will have a fix soon.
--mf

Azure Resource Manager template deployment with Visual Studio

I want to deploy resources to my Azure subscription with Visual Studio. I created a new "Azure Resource Group" project and see WebSite.json, WebSite.parameters.json and Deploy-AzureResourceGroup.ps1.
When I right-click on the project and choose "New Deployment" I can login to my subscription in the pop up window. But when I click the "Deploy" button I see in the output window my correct Account, TenantId, SbuscriptionId and Name but then only errors:
15:47:58 - [ERROR] New-AzureRmResourceGroup : Run Login-AzureRmAccount to login.
15:47:58 - [ERROR] At C:\Users\Frederic\Documents\Visual Studio 2015\Projects\AzureResourceGroup1\
15:47:58 - [ERROR] AzureResourceGroup1\bin\Debug\staging\AzureResourceGroup1\Scripts\Deploy-AzureR
15:47:58 - [ERROR] esourceGroup.ps1:96 char:1
15:47:58 - [ERROR] + New-AzureRmResourceGroup -Name $ResourceGroupName -Location $Resource ...
When I open a PowerShell command window and run Login-AzureRmAccount first it works but what am I missing (or how to do it) with VS?
I was for three weeks in holidays and when I came back there was the Windows Anniversary Update and the new Azure SDK 2.9 that I installed and one of them has solved the problem. Now I can deploy Azure Resource templates from Visual Studio without problems :-)

Resources