Visual Studio Team Services - Deploy to local IIS server - iis

I am currently investigating VSTS for our CI/CD processes and am having a lot of trouble with deploying anything to our on prem webservers (IIS). All of the documentation I've found says to Create a new Deployment group by using the provided powershell script,as admin which I do, but always get the following error message:
Exception calling "DownloadFile" with "2" argument(s): "The request was aborted: Could not create SSL/TLS secure
channel."
At line:1 char:880
+ ... nalString, $True);}; $WebClient.DownloadFile($Uri, $agentZip);Add-Typ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : WebException
!Full Error message]1
It feels to me like it's having an issue with downloading the agent,possibly due to the firewall, but our network team have confirmed everything should be alright. Does anyone have any experience or suggestions with what the cause of error message might be?
I have raised a call with Microsoft, but they weren't sure either and suggested I manually download the Agent, which I managed to do successfully and can see an active agent, but that doesn't seem to have any relationship to the Deployment Group and I cant find anything that explains the relationship between Deployment Groups, Deployment Pools, Agent Pools and Agents!
I am really excited to get things working, but this is throwing a spanner in the works - Any help would be gratefully appreciated!!

The deployment agent is the build/release agent too, so you can configure it manually with --deploymentgroup parameter.
You can find the detail code in the provided powershell script:
.\config.cmd --deploymentgroup --deploymentgroupname "{deploy group name}" --agent $env:COMPUTERNAME --runasservice --work '_work' --url 'https://{account}.visualstudio.com/' --projectname '{project name}'

Related

Publishing dacpac to Azure SQL Managed Instance from on prem SQL Server 2016 via PowerShell failing "cannot publish to SQL Server 2014"

I'm trying to publish a dacpac extracted from a SQL Server 2016 on prem server to an Azure SQL Managed Instance using the below PowerShell, but this fails to the error below.
SqlPackage.exe /SourceFile:$DacPacFilePathName /Action:Publish /TargetServerName:$DatabaseServer /TargetDatabaseName:$DatabaseName /TargetUser:$User /TargetPassword:$Password
SqlPackage.exe : *** An error occurred during deployment plan generation. Deployment cannot continue.
At line:9 char:1
+ SqlPackage.exe /SourceFile:$DacPacFilePathName /Action:Publish /Targe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (*** An error oc...annot continue.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
A project which specifies SQL Server 2016 as the target platform cannot be published to SQL Server 2014.
If I create a new DB in the Azure Managed Instance and create a dacpac from that, I'm able to use the same PowerShell command to publish it and it works fine.
Any ideas what's causing this issue?
Solved the issue.
The $env:Path on our deployment server was set to use SQLDB\DAC\140\SqlPackage.exe but SQL Managed Instance will only work with SQLDB\DAC\150\SqlPackage.exe
The error was already trying to explain the issue
A project which specifies SQL Server 2016 as the target platform
cannot be published to SQL Server 2014.
So here you can find the Microsoft page for the target change when using DataPacs.

Fault Analysis Service missing from Service Fabric Cluster

I am planning to use service fabric chaos to test my service, however starting it gives me the following error:
Start-ServiceFabricChaos : An error occurred during this operation. Please check the trace logs for more details.
At line:1 char:1
+ Start-ServiceFabricChaos -TimeToRunMinute 60 -MaxConcurrentFaults 3 - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Servi...usterConnection:ClusterConnection) [Start-ServiceFabricChaos], FabricException
+ FullyQualifiedErrorId : StartChaosCommandErrorId,Microsoft.ServiceFabric.Powershell.StartChaos
I don't see any trace files but upon looking at Service Fabric explorer, I don't see the Fault Analysis Service listed under System application. The only system services I see are clustermanagerservice, failovermanagerservice, namingservice.
What is causing the fault analysis service to be missing ?
Control panel shows the following bits installed:
Microsoft Azure Service Fabric 6.2.283.9494
Microsoft Azure Service Fabric SDK 3.1.283.9494
The service only starts if minimum 5 node dev cluster used. After resetting the cluster by following the link here, it worked as expected. All services showed up.
reset SF cluster

Unable to deploy to Azure Service Fabric party cluster from Visual Studio 2017

I'm trying to publish a solution to a service fabric cluster, but something's going wrong. I've got access to a party cluster, downloaded the cert and installed. Connecting to Service Fabric Explorer works fine. Connecting to the cluster using Powershell seems to work. But the "Publish Service Fabric Application" dialog in Visual Studio 2017 does not accept the Connection Endpoint and shows a red icon next to the textbox. If I try to publish the solution anyway I get the following output in the console:
WARNING: Failed to contact Naming Service. Attempting to contact Failover Manager Service...
4>WARNING: Failed to contact Failover Manager Service, Attempting to contact FMM...
4>Connect-ServiceFabricCluster : Could not ping any of the provided Service Fabric gateway endpoints.
4>At C:\Users\jnsst\source\repos\Voting\Voting\Scripts\Deploy-FabricApplication.ps1:185 char:16
4>+ ... [void](Connect-ServiceFabricCluster #ClusterConnectionParameters ...
4>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4> + CategoryInfo : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricTransientException
4> + FullyQualifiedErrorId : TestClusterConnectionerror.Id,Microsoft.ServiceFabric.Powershell.ConnectCluster
4>
4>WARNING: Unable to Verify connection to Service Fabric cluster.
4>Test-ServiceFabricClusterConnection : Cluster connection instance is null
I've followed all the instructions on learn.microsoft.com, but I'm obviously doing something wrong. Probably some silly small mistake.
I'm running Visual Studio 2017 Community on Windows 10.
Maybe I need to tell Visual Studio where the certs are stored?
Do you have any ideas?
install the certificate in your personal store, make sure it has the private key
make sure your publish profile (cloud.xml) looks similar to this:
<ClusterConnectionParameters
ConnectionEndpoint="mycluster.westus.cloudapp.azure.com:19000"
X509Credential="true"
ServerCertThumbprint="0123456789012345678901234567890123456789"
FindType="FindByThumbprint"
FindValue="9876543210987654321098765432109876543210"
StoreLocation="CurrentUser"
StoreName="My" />

Can I use the SwapWithPreviewAction command switch to swap deployment slots when the Azure app service has authentication enabled?

My app service is
running on Azure
has authentication enabled (API Management - ClientId and Secret)
has a deployment slot called staging
Before we enabled the authentication we could run the following powershell command to swap staging and production slots:
Switch-AzureRmWebAppSlot -SourceSlotName "staging" -DestinationSlotName "production" -Name "app1" -ResourceGroupName "group1" -verbose -SwapWithPreviewAction ApplySlotConfig
Swap with preview allows us to verify the deployed code works with the production configuration settings before switching users over to the newly deployed version.
However, after we enabled authentication to protect our app, we now receive the following error using the SwapWithPreviewAction
Switch-AzureRmWebAppSlot : Swap with Preview cannot be used when one of the slots has site authentication enabled.
At line:3 char:19
+ ... e-Command { Switch-AzureRmWebAppSlot -SourceSlotName "staging" -Desti ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Switch-AzureRmWebAppSlot], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.WebApps.Cmdlets.DeploymentSlots.SwitchAzureWebAppSlot
Does anyone know if it is possible to run swaps with authentication enabled? If so, how?
If you are using Authentication Authorization you can't 2 stage swap (aka swap with preview) however you should be able to do regular swap.
The main reason here is that Authentication/Authorization feature relies on having the right hostnames configured so that requests can be redirected back to the application after the authentication handshake.
This is also the reason why authentication/authorization is sticky to the slot.
EDIT
I have included a screenshot that shows the error the API generates for this operation.

Azure "Conflict: Cannot modify this site because another operation is in progress." error from Powershell command

I keep getting this error on two of my four Azure webapps when trying to run my Powershell script to swap my preprod and prod slots.
The command Start-AzureWebsite -Name $WebSiteName -Slot $SourceSlotName results in the following error:
Conflict: Cannot modify this site because another operation is in progress. Details: Id: b98d4832-5f6b-4bad-9c4e-470a2d0d100c, OperationName:
SwapSiteSlots, CreatedTime: 2/1/2016 9:30:54 PM, WebSystemName: websites, SubscriptionName: bd3570da-d430-485a-a83c-d4ef448b865e, WebspaceName: *******EastUSwebspace,
SiteName: *******, SlotName: preprod, ServerFarmName:
At C:\dev\...\scripts\Swap-AzureWebApp.ps1:18 char:1
+ Start-AzureWebsite -Name $WebSiteName -Slot $SourceSlotName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Start-AzureWebsite], CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Websites.StartAzureWebsiteCommand
No operation is in progress, but I did Git push to my preprod slot some 30 minutes ago...
It looks likes this question, but it is from Powershell, not visual studio, and I'm trying to start a preprod slot, then swap it.
It resolved itself, sigh. :/
Both of my Webapps that had errors with my scripts now swap without any error (using the same script).
I waited for about 1h...
I also faced the same issue when try to swap the app from staging to production in CD pipeline. As a solution deleted the staging slot and re deployed.
Then it worked.
Go to each 'slot' on the portal. (Each slow shows up as a separate app service in your resource group named "appservice-name/slot-name" format)
on each 'slot' app service, go to deployment slots blade
On the top, click on 'Complete Swap', then select 'Cancel Swap' in the drop down
Click 'Cancel Swap'
Only one of these operations will succeed, and others will show the same error.
If you don't see the "Complete Swap" button, you'll just have to wait, think up to one hour.
Once succeeded, wait a few minutes before attempting to deploy/start to app service again.

Resources