I have a requirement to set up TFS build that auto deploys build deployment result to a remote server location/folder. In order to access this remote deployment folder, I would need to first access a proxy server A, and then from the proxy, I am then able to access machine where the deployment location/folder is located. How do I set this up on TFS please? How do I set up a build that on success makes the two jumps required to get to the deployment destination? Thanks in advance
You should not do this with the Build server. Its for compiling and testing your code. If you look at Release Management for TFS2013 you can configure a deployment to execute how you describe fairly easily.
http://nakedalm.com/installing-release-management-server-tfs-2013/
Related
I honestly don't know where to start apart from mentioning I've tried absolutely everything and I feel like banging my head against the wall!
I've configured my IIS according to the Microsoft docs and also added Web Deploy 3.6.
In my services I have the following running:
In my windows firewall I have opened port 8172:
In my IIS I have enabled remote connections:
Within IIS I have a Site which points to an empty folder, when I right click -> Deploy -> Configure Web Deploy publishing I get this:
Using this, I've set up a publish profile in VS like so:
But get this error why I try and 'Validate' the connection:
Severity Code Description Project File Line Suppression State
Error Web deployment task failed. (Could not connect to the remote computer ("server2021"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.)
This error indicates that you cannot connect to the server. Make sure the service URL is correct, firewall and network settings on this computer and on the server computer are configured properly, and the appropriate services have been started on the server.
Error details:
Could not connect to the remote computer ("server2021"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.
Unable to connect to the remote server
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I can't even remote to this server, I'm accessing it using TeamViewer.
I've viewed EventViewer logs on my local machine and it just says the same error which VS is spitting out.
I honestly don't know what I'm doing and I'd really really appreciate any help
I have configured TFS Proxy server and have set the source control setting of my local VS client. Also TFS Application server & TFS Proxy server both are in same network Domain.
But when i am taking get latest of any team project and second time taking the get latest of same team project at different machine but files are downloading Main server and giving below warning.
TF15013: The requested Team Foundation Server is not registered with the proxy server.
Can Anyone help me out how to resolve this issue & make fast get latest.
Thanks,
You can try to use the proxy command to configure your client to use a proxy server: see Proxy Command
eg :
c:\projects>tf proxy /add http://server:8081 /default:global /collection:http://tfsserver:8080/
If that still not work, recommend you to reconfigure the Proxy, you must use service accounts to install Team Foundation Server, and Team Foundation Server Proxy. These service accounts become the identity for the installed component.
By default, every component uses a built-in account (such as Network Service) as its service account.Built-in accounts do not use passwords and already have the Log on as a service permission, making them easier to manage, especially in a domain environment. See requirements.
After that you can reference below link to configure the TFS proxy to work with Your TFS:
https://blogs.msdn.microsoft.com/buckh/2016/10/12/how-to-configure-a-tfs-proxy-to-work-with-team-services/
Update:
TFS 2013 is Xaml build system, double chick the definition will pop up the definition to edit. TFS 2017 is vNext build system, it will redirect to web client build progress page. That's by design, not related to the source settings.
And as far as I know, there isn't the utility or third part tools can open the vNext build definition in VS directly, vNext build definition is task independent, you can edit it conveniently via web portal.
Im having a bit of trouble web deploying from my CI server teamcity.I can however do a web deploy through visual studio.
I get the following error
Open in IDE
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4276,
5): error ERROR_DESTINATION_NOT_REACHABLE: Web deployment task failed.
(Could not connect to the remote computer ("destinationserver"). On
the remote computer, make sure that Web Deploy is installed and that
the required process ("Web Deployment Agent Service") is started.
Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.)
and this is my configuration in team city
enter image description here
i have also opened up port 8172 so i dont think it is a permissions issue and checked the username and pass is correct
So what i dont understand is why i am able to publish locally but not from the CI?
Thanks,
Martin
I solve this replacing the IP address of the destination host with the DNS name and adding this parameter to the deployment:
/P:MsDeployServiceUrl=https://%TargetServer%/MsDeploy.axd?site=%SiteName%
We are running our build and test process on TFS Online. This works fine, until we try to connect to an external service. In our case a SQL Database.
The discussion about what we should mock and not is not really helpful in this case, as currently we need to do this.
We also tried just a simple ping, but not even that is getting out:
Test-Connection "172.217.18.100" #resolves to www.google.com
Testing connection to computer '172.217.18.100' failed: Error due to lack of resources
So we have the impression that most outside IP's/Ports/etc. could be locked?
Is there a way to open this up? If yes, how?
I can't imagine that we are the first ones to try something like that? Downloading something from a website, making a REST all, etc? Should be possible somehow, no?
Update 1:
We had a bit a more detailed question about this issue here, but figured it was a more generic problem.
The error message when we connect to Azure SQL is
System.Data.SqlClient.SqlException:
A network-related or instance-specific error occurred while establishing a connection to SQL Server.
The server was not found or was not accessible.
Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)`
But the Named Pipes Provider part is missleading. You also get this message locally if you try to connect to an IP that does not exist.
We access Azure SQL from our C# NUnit tests.
Update 2:
We tried out the idea from #starain-MSFT and installed the Azure SQL Execute Query step/task. Installation works fine, but it seems to miss a component. See picture below.
No agent could be found with the following capabilities: azureps,
sqlps, npm, node.js, msbuild, visualstudio, vstest
Based on installed apps list I assume it's azureps.
Solution (partly):
Ok, so we went down the wrong route all the way. The problem is not the firewall (or any firewalls for that matter). The problem was that our app.config file didn't had the right settings in it.
We had the same setup for our App.config files inside the unit tests as for our Web.config files. Each had a App.Debug.config and a App.Release.config file attached. While this worked fine for the web applications, this obviously didn't work for our unit tests.
We are still looking for a good solution here.
I found this solution on how to add a transform task inside Visual Studio, but this is not exactly what we are searching, because we don't need the transform locally, but only in Visual Studio Teams.
app.config Transform inside Visual Studio Teams
So, I think we finally got it. With ConfigTransform, we can now transform our app.config files during the build process.
Using Hosted Agents, the SQL Server need to be accessible from internet in order to connect to your SQL Server from Hosted Agents.
The way to deal with this issue:
As Giulio said that set up an on premise build agent, then you just need to make sure the SQL Server instance can be accessible from that build agent (can be intranet).
Apply a SQL Server on internet, such as Azure SQL Server that can be accessible from internet.
Configure your SQL Server and network to let your SQL Server can be accessible from internet.
BTW, regarding your simple ping test, that IP address is used for its web site and the port is 80, you can access other resource with that IP. You can open another port on your server and access resource by IP with port.
Update 1:
Refer to this way to add Azure SQL Server Firewall Rule:
Check Allow Scripts to Access OAuth Token option (Options of build definition)
Add Azure PowerShell build step before test step (Arguments: -RestAddress https://[your vsts account].vsdtl.visualstudio.com/DefaultCollection/_apis/vslabs/ipaddress -Token $(System.AccessToken) -RG [resource group] -Server [server name(without .database.windows.net)]
Script:
param (
[string]$RestAddress,
[string]$Token,
[string]$RG,
[string]$Server
)
$basicAuth = ("{0}:{1}" -f 'test',$Token)
$basicAuth = [System.Text.Encoding]::UTF8.GetBytes($basicAuth)
$basicAuth = [System.Convert]::ToBase64String($basicAuth)
$headers = #{Authorization=("Basic {0}" -f $basicAuth)}
$result = Invoke-RestMethod -Uri $RestAddress -headers $headers -Method Get
Write-Host $result.value
New-AzureRmSqlServerFirewallRule -ResourceGroupName $RG -ServerName $Server -FirewallRuleName "UnitTestRule" -StartIpAddress "$($result.value)" -EndIpAddress "$($result.value)"
BTW, you can refer to that script to remove the firewall rule after test.
Update 2:
The SQL ConnectionString like this:
Server=tcp:[server name].database.windows.net,1433;Initial Catalog=sqlstarain1;Persist Security Info=False;User ID=[user name];Password=[password];MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
Windows Hosted build agents don't block 1433 outbound.
If you want to connect to SQL Azure through hosted build agents ensure that you enabled in your SQL Azure firewall settings "Allow access to Azure services". You don't need to run a script manually.
SQL Azure Firewall settings
Ensure you are using the right connection string during unit testing. E.g. in MSTest you need to add your connection string into App.config of you UnitTest project.
<connectionStrings>
<add name ="TestContext" providerName="System.Data.SqlClient"
connectionString="Server=tcp:[ServerName].database.windows.net,1433;Initial Catalog=[DB Name];Persist Security Info=False;User ID=[User];Password=[Password];MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"/>
</connectionStrings>
That's it. I just did a quick test with EF, SQL Azure & VSTS Hosted Agent and it worked.
I assume that your are using the Hosted Agents, which means that the machine is a shared resource between many VSTS accounts (tenants) and managed (and locked) down by Microsoft.
You can easily install an agent on your own virtual machine and run the build there. The VM can be in the cloud or on premise, your choice. You trade simplicity and cheapness for full control.
Update:
Hosted Agents allows HTTP(S) calls which cover a lot of grounds. While useful I do not think it solves the original question to connect to a SQL database.
I'm testing a ClickOnce application deployment. I have setup a virtual directory on my machine (running IIS). I have specified http://localhost/SampleApplication as the Installation Folder URL in the Publish tab of Visual Studio. However, when I publish the application I get the following error:
Warning: Files could not be downloaded
from http://chrish/SampleApplication/.
The remote server returned an error:
(407) Proxy Authentication Required.
Publish success.
Warning: Unable to
view published application at
http://chrish/SampleApplication/publish.htm.
http://chrish/SampleApplication/publish.htm
Notice how it has changed my url from Localhost to my login name. Why? This wasn't happening a week ago.
ClickOnce installation involves verifying that the server name matches the expected name. Thus localhost always gets translated under the covers to the computer name [not the username as you suggest in your question] (one of many confusing things ClickOnce does - one side effect of this is that if you want to set up 3 download servers, you need to do 3 separate publishes and/or script the publish like this) or like this. So this is not a surprise - it's always doing that under the covers.
The 407 error relates to proxy auth. This implies downloading is being diverted via a proxy such as Microsoft ISA Server. Have a look in your IE Internet Options Connections Proxy Settings and make sure its bypassing for local addresses [such as chrish].
The reason it's reporting success is that the upload likely uses an alternate mechanism than the verification does and isn't being routed via / blocked by the proxy. (The underlying problem is that the .NET framework does not by default pass proxy credentials and you'd need to either apply a config entry for devenv or whatever does the publish or have the build process call a test step with extra code that does send the proxy credentials](http://blogs.msdn.com/jpsanders/archive/2009/03/24/httpwebrequest-webexcepton-the-remote-server-returned-an-error-407-proxy-authentication-required.aspx). See also How should I set the default proxy to use default credentials?)
ClickOnce doesn't like "localhost", but you can work around that.
If you set the Publishing Folder Location to:
C:\inetpub\wwwroot\SampleApplication\
and the Installation Folder URL to:
http://chrish/SampleApplication/
(where "chrish" is the network name of your computer) then you can publish locally.