The "InvokePowerShell" task failed unexpectedly when publishing from Visual Studio to Azure - azure

Recently I copied my project (ASP.NET Core on Visual Studio 2015) to a new computer. Everything is set up except that I can't seem to publish to the existing App Service without getting an "InvokePowerShell" error.
I have tried creating a new publish profile, resetting the publish profile for the App Service on Azure, running Visual Studio as administrator but no good. Anyone kindly have an idea how to solve this?
Published 1/1 projects successfully
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(408,5): Error MSB4018: The "InvokePowerShell" task failed unexpectedly.
System.Management.Automation.PSSecurityException: AuthorizationManager check failed. ---> System.Management.Automation.Host.HostException: A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run C:\Users\rober\OneDrive\Documents\Visual Studio 2015\Projects\willfon\src\willfon\Properties\PublishProfiles\willfon20180423121452 - Web Deploy-publish.ps1?
at System.Management.Automation.Internal.Host.InternalHostUserInterface.ThrowPromptNotInteractive(String promptMessage)
at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)
at Microsoft.PowerShell.PSAuthorizationManager.RemoteFilePrompt(String path, PSHost host)
at Microsoft.PowerShell.PSAuthorizationManager.CheckPolicy(ExternalScriptInfo script, PSHost host, Exception& reason)
at Microsoft.PowerShell.PSAuthorizationManager.ShouldRun(CommandInfo commandInfo, CommandOrigin origin, PSHost host, Exception& reason)
at System.Management.Automation.AuthorizationManager.ShouldRunInternal(CommandInfo commandInfo, CommandOrigin origin, PSHost host)
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
at Microsoft.Web.Publishing.Tasks.InvokePowerShell.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>Publish failed due to build errors. Check the error list for more details.
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
2-27-2020 And now today it's working. Who knows why.

Related

"SPManager.Initialize failed" when running PSConfig on sharepoint 2013

I am trying to update a sp2013 farm from SP1+July 2016 CU to the August 2020 CU. I've already installed the patch, and am trying to run PSCONFIG now.
The first APP server (which runs Central admin) PSCONFIG command completed successfully, but I have been unable to get any of the remaining servers to complete - I've tried both WFE and another App server, in all cases, PSCONFIG exits with the following error:
> PSConfig.exe -cmd upgrade -inplace b2b -wait -cmd applicationcontent -install -cmd install
features -cmd secureresources
SharePoint Products Configuration Wizard version 15.0.4939.1000. Copyright (C) Microsoft Corporation 2012. All rights reserved.
Performing configuration task 1 of 7
Initializing SharePoint Products upgrade...
Waiting to get a lock to upgrade the farm.
Successfully initialized the SharePoint Products configuration.
Performing configuration task 2 of 7
Initiating the upgrade sequence...
Failed to initiate the upgrade sequence.
An exception of type Microsoft.SharePoint.Upgrade.SPUpgradeException was thrown. Additional exception information: Exception of type 'Microsoft.SharePoint.Upgrade.SPUpgradeException' was thrown.
Total number of configuration settings run: 2
Total number of successful configuration settings: 1
Total number of unsuccessful configuration settings: 5
Successfully stopped the configuration of SharePoint Products.
Configuration of SharePoint Products failed. Configuration must be performed before you use SharePoint Products.
For further details, see the diagnostic log located at d:\spdata\Logs\ULS\PSCDiagnostics_12_4_2020_16_38_33_727_1311047457.log and the application event log
When I check the PSCDiag file, the error is just "Exception of type 'Microsoft.SharePoint.Upgrade.SPUpgradeException' was thrown"
12/04/2020 15:56:42 12 ERR Task upgradebootstrap has failed with an unknown exception
12/04/2020 15:56:42 12 ERR Exception: Microsoft.SharePoint.Upgrade.SPUpgradeException: Exception of type 'Microsoft.SharePoint.Upgrade.SPUpgradeException' was thrown.
at Microsoft.SharePoint.Upgrade.SPManager.BootStrap(Guid sessionId, SPUpgradeOperationFlags flags)
at Microsoft.SharePoint.PostSetupConfiguration.UpgradeBootstrapTask.Run()
at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()
I've rebooted (multiple times)
Tried stopping/restarting IIS
Cleared the sharepoint config cache
Run Get-spProduct -local - it give an error the first time I run it, but then succeeds the second time (which is the same behavior I had on the first server which completed successfully)
> Get-SPProduct -Local
Get-SPProduct : Failed to call GetTypes on assembly
Microsoft.AnalysisServices.SPAddin, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91. Could not load file or assembly
'Microsoft.AnalysisServices.SPClient, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot
find the file specified.
At line:1 char:1
+ Get-SPProduct -Local
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share...letGetSPProduct:
SpCmdletGetSPProduct) [Get-SPProduct], SPUpgradeException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SpCmdletGetSPPro
duct
> Get-SPProduct -Local
ProductName Required Missing Servers
----------- -------- ------- -------
Microsoft SharePoint Server... True {}
Microsoftr Project Server 2013 True {}
I do see a few UNEXPECTED level errors in the ULS logs relating to Microsoft.AnalysisServices.SPAddin
ERROR Failed to call GetTypes on assembly Microsoft.AnalysisServices.SPAddin, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91. Could not load file or assembly 'Microsoft.AnalysisServices.SPClient, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. 00000000-0000-0000-0000-000000000000
and also one that appears related to inability to update the central admin - but I believe that would have been done when I ran PSConfig on the Central admin server, which completed successfully
12/04/2020 16:58:20.93 OWSTIMER (0x3254) 0x0B3C SharePoint Foundation Upgrade SPUpgradeSession ajxme ERROR CanUpgrade [SPContentDatabase Name=SYSdev_content_CentralAdmin] failed. 00000000-0000-0000-0000-000000000000
any suggestions are appreciated.
Thanks
I found the issue. The central admin server on which PSCONFIG completed successfully had SQL Server 2014 PowerPivot installed, but the other servers in the farm all had SQL Server 2012 PowerPivot installed. (this is dev environment, and PowerPivot had been installed for testing long ago).
I uninstalled SQL Server 2012 PowerPivot and installed SQL Server 2014 PowerPivot on all other servers. PSCONFIG then completed successfully on all the servers.

No cluster endpoint is reachable, please check if there is connectivity/firewall/DNS

I'm new to Azure and Service Fabric.
Today I installed the VS Service Fabric tools and the SDK (latest 3.3.617)
My home desktop has Win10 pro x64 with 8GB RAM.
I tried to run a "hello world" app from the "new project" using VS. Compilation works and then it starts to spin up the local cluster.
I get this error:
1>------ Build started: Project: Stateless1, Configuration: Debug x64 ------
1> Stateless1 -> C:\Users\USER\source\repos\Application2\Stateless1\bin\x64\Debug\Stateless1.exe
2>------ Build started: Project: Application2, Configuration: Debug x64 ------
3>------ Deploy started: Project: Application2, Configuration: Debug x64 ------
3>Started executing script 'GetApplicationExistence'.
3>Finished executing script 'GetApplicationExistence'.
3>Time elapsed: 00:00:00.4751003
3>Started executing script 'Set-LocalClusterReady'.
3>powershell -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Scripts\DefaultLocalClusterSetup.psm1'; Set-LocalClusterReady -createOneNodeCluster $true"
3>--------------------------------------------
3>Local Service Fabric Cluster is not setup...
3>Please wait while we setup the Local Service Fabric Cluster. This may take few minutes...
3>Performing Stop-Service on service: FabricHostSvc . This may take a few minutes...
3>
3>Using Cluster Data Root: C:\SfDevCluster\Data
3>Using Cluster Log Root: C:\SfDevCluster\Log
3>
3>The generated json path is C:\Users\USER\AppData\Local\Temp\tmpE26D.tmp.json
3>Processing and validating cluster config.
3>Check if machine 'ComputerFullName' is IOT Core: False. Could not open registry key.
3>Performing Stop-Service on service: FabricHostSvc . This may take a few minutes...
3>Create node configuration succeeded
3>Performing Start-Service on service: FabricHostSvc . This may take a few minutes...
3>
3>Waiting for Service Fabric Cluster to be ready. This may take a few minutes...
3>Local Cluster ready status: 4% completed.
3>Local Cluster ready status: 8% completed.
3>Local Cluster ready status: 100% completed.
3>WARNING: Service Fabric Cluster is taking longer than expected to connect.
3>
3>Waiting for fabric:/System/NamingService to be ready. This may take a few minutes...
3>Connect-ServiceFabricCluster : No cluster endpoint is reachable, please check if there is connectivity/firewall/DNS
3>issue.
3>At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Scripts\ClusterSetupUtilities.psm1:979 char:12
3>+ [void](Connect-ServiceFabricCluster #connParams)
3>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3> + CategoryInfo : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricException
3> + FullyQualifiedErrorId : TestClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster
3>
3>fabric:/System/NamingService ready status: 8% completed.
3>fabric:/System/NamingService ready status: 17% completed.
3>fabric:/System/NamingService ready status: 92% completed.
3>fabric:/System/NamingService ready status: 100% completed.
3>WARNING: fabric:/System/NamingService is taking longer than expected to be ready...
3>Local Service Fabric Cluster created successfully.
3>--------------------------------------------------
3>Launching Service Fabric Local Cluster Manager...
3>You can use Service Fabric Local Cluster Manager (system tray application) to manage your local dev cluster.
3>Finished executing script 'Set-LocalClusterReady'.
3>Time elapsed: 00:12:29.9792319
3>The PowerShell script failed to execute.
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
I tried closing down my Windows firewall and debugging again, now getting:
Unable to determine whether the application is installed on the cluster or not
Unable to determine whether the application is installed on the cluster or not
I have encountered this error before and have solved it in 2 ways:
I simply redeployed to the local cluster.
I stopped the local cluster from the tray menu before redeploying.

Anchore Engine - Jenkins CI plugin

We are trying to scan our docker images using Anchore Engine Jenkins plugin.
Currently we create our application docker images, push it in our own private local registry and then deploy it in our test environments.
Now, we want to setup docker image scanning in our CI/CD process to check for any vulnerabilities.
We have installed Anchore Engine using the recommended Docker-Compose yaml method given in the Documentation link:
https://anchore.freshdesk.com/support/solutions/articles/36000020729-install-on-docker-swarm
Post installation, we installed the
Anchore Container Image Scanner Plugin in Jenkins.
We configured the plugin as mentioned in the document link:
https://wiki.jenkins.io/display/JENKINS/Anchore+Container+Image+Scanner+Plugin
However, the scanning fails. Error Message as follows:
2018-10-11T07:01:44.647 INFO AnchoreWorker Analysis request accepted, received image digest sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8
2018-10-11T07:01:44.647 INFO AnchoreWorker Waiting for analysis of 10.180.25.2:5000/hello-world:latest, polling status periodically
2018-10-11T07:01:44.647 DEBUG AnchoreWorker anchore-engine get policy evaluation URL: http://10.180.25.2:8228/v1/images/sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8/check?tag=10.180.25.2:5000/hello-world:latest&detail=true
2018-10-11T07:01:44.648 DEBUG AnchoreWorker Attempting anchore-engine get policy evaluation (1/300)
2018-10-11T07:01:44.675 DEBUG AnchoreWorker anchore-engine get policy evaluation failed. URL: http://10.180.25.2:8228/v1/images/sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8/check?tag=10.180.25.2:5000/hello-world:latest&detail=true, status: HTTP/1.1 404 NOT FOUND, error: {
"detail": {},
"httpcode": 404,
"message": "image is not analyzed - analysis_status: not_analyzed"
}
NOTE:
In Image TAG 10.180.25.2:5000/hello-world:latest, 10.180.25.2:5000 is our local private registry and hello-world:latest is latest hello-world image available in docker hub which we pulled and pushed in our registry to try out image scanning using Anchore-Engine.
Unfortunately we are not able to find much resource online to try and resolve the above mentioned issue.
Anyone who might have worked on Anchore-Engine, please may I request to have a look and help us resolve this issue.
Also, any suggestions or alternatives to anchore-engine or detailed steps in case we might have missed anything would be really appreciated.
End of the output is as follows:
2018-10-15T00:48:43.880 WARN AnchoreWorker anchore-engine get policy evaluation failed. HTTP method: GET, URL: http://10.180.25.2:8228/v1/images/sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8/check?tag=10.180.25.2:5000/hello-world:latest&detail=true, status: 404, error: {
"detail": {},
"httpcode": 404,
"message": "image is not analyzed - analysis_status: not_analyzed"
}
2018-10-15T00:48:43.880 WARN AnchoreWorker Exhausted all attempts polling anchore-engine. Analysis is incomplete for sha256:7d6fb7e5e7a74a4309cc436f6d11c29a96cbf27a4a8cb45a50cb0a326dc32fe8
2018-10-15T00:48:43.880 ERROR AnchorePlugin Failing Anchore Container Image Scanner Plugin step due to errors in plugin execution
hudson.AbortException: Timed out waiting for anchore-engine analysis to complete (increasing engineRetries might help). Check above logs for errors from anchore-engine
at com.anchore.jenkins.plugins.anchore.BuildWorker.runGatesEngine(BuildWorker.java:480)
at com.anchore.jenkins.plugins.anchore.BuildWorker.runGates(BuildWorker.java:343)
at com.anchore.jenkins.plugins.anchore.AnchoreBuilder.perform(AnchoreBuilder.java:338)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1724)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
I also checked status and found below:
docker run anchore/engine-cli:latest anchore-cli --u admin --p admin123 --url http://172.18.0.1:8228/v1 system status
Service analyzer (dockerhostid-anchore-engine, http://anchore-engine:8084): up
Service catalog (dockerhostid-anchore-engine, http://anchore-engine:8082): up
Service policy_engine (dockerhostid-anchore-engine, http://anchore-engine:8087): down (unavailable)
Service simplequeue (dockerhostid-anchore-engine, http://anchore-engine:8083): up
Service apiext (dockerhostid-anchore-engine, http://anchore-engine:8228): up
Service kubernetes_webhook (dockerhostid-anchore-engine, http://anchore-engine:8338): up
Engine DB Version: 0.0.7
Engine Code Version: 0.2.4
It seems service policy engine is down
Service policy_engine (dockerhostid-anchore-engine, http://anchore-engine:8087): down (unavailable)
I also checked the docker logs . I found below error:
[service:policy_engine] 2018-10-15 09:37:46+0000 [-] [bootstrap] [DEBUG] service (policy_engine) starting in: 4
[service:policy_engine] 2018-10-15 09:37:46+0000 [-] [bootstrap] [INFO] Registration complete.
[service:policy_engine] 2018-10-15 09:37:46+0000 [-] [bootstrap] [INFO] Checking feeds client credentials
[service:policy_engine] 2018-10-15 09:37:46+0000 [-] [bootstrap] [DEBUG] Initializing a feeds client
[service:policy_engine] 2018-10-15 09:37:47+0000 [-] [bootstrap] [DEBUG] init values: [None, None, None, (), None, None]
[service:policy_engine] 2018-10-15 09:37:47+0000 [-] [bootstrap] [DEBUG] using values: ['https://ancho.re/v1/service/feeds', 'https://ancho.re/oauth/token', 'https://ancho.re/v1/account/users', 'anon#ancho.re', 3, 60]
[service:policy_engine] 2018-10-15 09:37:47+0000 [-] [urllib3.connectionpool] [DEBUG] Starting new HTTPS connection (1): ancho.re
[service:policy_engine] 2018-10-15 09:37:50+0000 [-] [bootstrap] [ERROR] Preflight checks failed with error: HTTPSConnectionPool(host='ancho.re', port=443): Max retries exceeded with url: /v1/account/users/anon#ancho.re (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ffa905f0b90>: Failed to establish a new connection: [Errno 113] No route to host',)). Aborting service startup
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/anchore_manager/cli/service.py", line 158, in startup_service
raise Exception("process exited: " + str(rc))
Exception: process exited: 1
[anchore-policy-engine] [anchore_manager.cli.service/startup_service()] [INFO] service process exited at (Mon Oct 15 09:37:50 2018): process exited: 1
[anchore-policy-engine] [anchore_manager.cli.service/startup_service()] [INFO] exiting service thread
Thanks and Regards,
Rohan Shetty
When images are added to anchore-engine, they are queued for analysis which moves them through a simple state machine that starts with ‘not_analyzed’, goes to ‘analyzing’ and finally ends in either ‘analyzed’ or ‘analysis_failed’. Only when an image has reached ‘analyzed’ will a policy evaluation be possible.
The anchore Jenkins plugin will add an image, then poll the engine for image status/evaluation for the configured number of tries (default 300). Once the image goes to ‘analyzed’ (where policy evaluation is possible), the plugin will then receive a policy evaluation result from the engine.
The plugin will fail the build (by default) if the max retries has been performed and the image has not reached ‘analyzed’, if the image does reach ‘analyzed’ but the policy evaluation is producing a ‘fail’ result (meaning the image didn’t pass your configured policy checks). Note that all build failure behavior can be controlled in the plugin (I.e. there are options to allow the plugin to succeed even if the analysis or image eval fails).
You’ll need to look at the end of the output from your build run (instead of just the beginning from your post), and combined with the information above, it should be clear which scenario is causing the plugin to fail the build.
We have resolved the issue.
Root Cause:
We were not able to establish a successful https connection to URL : https://ancho.re from within the anchore-engine docker container.
As a result the service:policy_engine was not able to start.
https://ancho.re is required to download policy feeds and sync-up periodically. Without these policy anchore-engine won't be able to analyse the docker images.
Solution:
1) We passed a HTTPS_PROXY URL as an environment variable in the docker-compose.yaml of anchore-engine.
We used this proxy URL to bypass restrictions in our environment and establish a connection with https://ancho.re url.
2) Restarted the docker containers.
Finally we got all services up and running including Anchore policy-engine.
FYI:
It takes a while to download all the required Feeds depending on your internet speed.
Lastly, Thanks to the Anchore community for quick responses and support over slack.
Hope this helps.
Warm Regards,
Rohan Shetty

ASP.Net Core 2.0 IIS error on Windows 2012 R2

I installed :
dotnet-runtime-2.0.0-win-x64.exe
dotnet-sdk-2.0.0-win-x64.exe
DotNetCore.2.0.0-WindowsHosting.exe
On command prompt if I type dotnet, this appears:
api-ms-win-crt-runtime-l1-1-0.dll missing
On IIS on Windows Server 2012 R2 ASP.Net core 2.0 is returning this:
HTTP Error 502.5 - Process Failure
Common causes of this issue:
The application process failed to start The application process
started but then stopped The application process started but failed to
listen on the configured port
Troubleshooting steps:
Check the system event log for error messages Enable logging the
application process' stdout messages Attach a debugger to the
application process and inspect
For more information visit:
https://go.microsoft.com/fwlink/?LinkID=808681
On Windows Logs, this appears:
Application 'MACHINE/WEBROOT/APPHOST/CRUD' with physical root
'C:\inetpub\wwwroot\WebAPI\CRUD\' failed to start process with
commandline 'dotnet .\CRUD.dll', ErrorCode = '0x80004005 : c0000135.
How to solve this problem?

Unable to publish Azure website

When we are trying to publish site to Azure from VS 2013 we are getting
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4270,5): Warning : Retrying the sync because a socket error (10054) occurred.
Retrying operation 'Serialization' on object sitemanifest (sourcePath). Attempt 1 of 10.
can you guys have any idea why I am getting this error? Previously it was working.

Resources