Set TrustedHosts on Visual Studio Team Services - azure-devops

I'm trying to deploy a build to a VM using the Manage IIS App agent task on Visual Studio Team Services. However, when I attempt to connect via HTTP, it comes back with the following error:
The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts
Unfortunately, I don't have the ability to deploy over HTTPs for reasons beyond my control so I'm trying to get around this issue by setting the VM as a trusted host, but I can't figure out how to do this using VS Online.

You can’t add trusted host to Hosted build agent (Get access is denied result if add trusted host via winrm command during build)
You can setup a new build agent and configure it to add trusted host with winrm s winrm/config/client '#{TrustedHosts="RemoteComputer"} command, after that, using this build agent to build/release.
About how to setup a new build agent, you can refer to this article.

Related

Error: Error: Failed to deploy web package to App Service. Error: tunneling socket could not be established, statusCode=503

We are getting below error on Azure devops pipeline via Self hosted agent release when Azure web app is on Private network. No Error seen when the web app on azure is on Public.
Error: Error: Failed to deploy web package to App Service. Error: tunneling socket could not be established, statusCode=503
Made Azure web app to private and error comes. Moved to public no error seen.
Seems that the self-hosted agent cannot connect to the Azure app service. It seems to be a network issue.
The agent needs a way to connect to the App service directly. To ensure the connectivity is ok, we need to make sure the self-hosted agent is not blocked by NSG rules or App Service networking Access Restrictions. Just whitelist the agent machine in your rules.
The task using Kudu REST API to deploy the application. We need to check the following App Service networking Access Restrictions to allow deployment from a specific agent:
Make sure the REST site “xxx.scm.azurewebsites.net” have Allow All, i.e. no restriction.
Also, the option “Same restrictions as ***.azurewebsites.net” should be unchecked.
If you are using Private Endpoints for Azure Web App, you must create two records in your Azure DNS private zone or your custom DNS server. Kindly check DNS for more details.
Besides, when the proxy is set up, Web API calls and SCM hosts are bypassed by the user. The same has to be configured in the Azure pipelines agent explicitly. To bypass specific hosts, follow the steps here and restart the agent.
1.Allow access to Public removed.
2.Created Pvt endpoints within same Vnet and Subnet of Target VM
3.Created new file .proxybypass in self hosted agent folder C:\Username\Agent
4.Added below entries in .proxybypass to allow and communicate bypassing corporate proxy
https://MyWebappname.azurewebsites.net
http://MyWebappname.azurewebsites.net
enter code here

TFS: Best way to deploy to remote web server

we have a TFS 2018 running inside our Intranet and want to deploy to a remote machine outside of our intranet. The TFS is not visible from the outside (behind Firewall and does not have its own IP)
So we came up with this solution, that might work:
Set up a VPN connection between the target machine and our intranet
Create an Azure Pipeline Agent on the target machine that uses a private access token to communicate to the TFS
Is there an easier solution to this, which doesn't require a VPN connection?
We thought we could deploy to a web share from TFS and then trigger the Azure Pipeline Agent on the target machine, to start the deployment. But from the documentation of Microsoft it seems as if the Agent has to have direct access to the TFS trough HTTPS and only "listens" to jobs in the TFS queue.
That means that the only other solution to a VPN connection from the target machine would be, to make our TFS accessible from the internet trough HTTPS, right?
Unfortunately, until now we haven't found a lot of documentation on "best practices" for this use case. That's why I decided to share it here. Thanks!

Is there a documented way to secure (with SSL) the localhost cluster for Azure service fabric?

This article shows to how to secure the service fabric cluster in the Azure:
https://azure.microsoft.com/en-us/documentation/articles/service-fabric-visualstudio-configure-secure-connections/
But it makes no references as to how to configure developer's machine for the same. I tried to apply the same principles in the above link to see if I can make it work. It always fails to deploy services locally but works like a charm when I publish them to azure's service fabric cluster. If I remove the secure bindings, I can deploy services to local cluster successfully. But this becomes tedious whenever I want to publish the services to the azure's secure cluster.
Does any one have an idea as to how to go about creating a secure service fabric cluster on developer's machine?
I am using Service Fabric version 5.5.216.0 and it seems to be working. Run powershell command:
PS C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup> .\DevClusterSetup.ps1 -PathToClusterDataRoot "C:\SfDevCluster\Data" -PathToClusterLogRoot "C:\SfDevCluster\Log" -AsSecureCluster
Then, open IE to browse "https://localhost:19080/Explorer/". You will see a popup asking you to choose which client certificate to connect. Use the one with name 'ServiceFabricDevClusterCert'. Chrome didn't work for me as it failed directly with no useful warning. Maybe somewhere in chrome I should enable popup window?

using Windows Azure Connect local endpoint to send email from web role

I am trying to send email using one of our on-premises servers from one of my web roles hosted on azure. We've got a Windows Azure Connect endpoint installed on this on-premises server which has an SMTP server.
We've configured the web role so that it contains an activation code I acquired using the windows azure portal and the azure subscription we have. The web role has been deployed to azure with this configuration. Looking in the virtual network section of the portal I can see our on-premises server listed as well as the instance of said web role. I Created a group connecting the local endpoint to the web role instance.
The problem I'm having now is figuring out exactly what I have to do in order for the emails I send from the web role to be relayed through the smtp server on the on-premises server.
My first thought was to just specify the local endpoint name as it appears in our azure portal as the host to use when I create my SmtpClient object in code. Of course this didn't work as I received an SmtpException just saying Failure Sending Email.
So my question is once I've set everything up as described above, what do I need to do in ,my web role code and/or configuration in order to use the local endpoint as the smtp host for sending out my emails??
How about open your firewall for the SMTP on both your azure VM and local server.
As I know the azure VM firewall disabled the PING (ICMP) but doesn't know if it blocked all ports except those defined in your CSDEF file.

Test agent cannot connect to Test controller on Windows Azure

I wanted to create a Test rig on cloud. I have created a windows azure hosted service that installs Test Controller and configures it with on premise DB. I have created another hosted service that installs Test Agent. I have enabled Virtual network in the Azure service by providing Activation token taken from azure portal. I also created a Azure Connect Group in which I added my local endpoint(On Premise DB) and windows azure roles( Test Controller rand Test Agent). When I deploy this on azure I am facing problem of Test Agent connectivity with Test Controller.
Test Controller can ping to my on premise DB machine and vice versa. But my test controller machine cannot ping test agent machine or vice versa on cloud.
I have ensured following things on test Controller
User testagent is part of group TeamTestAgentService
User testagent is also administrator on TestController hosted service.
Firewall exceptions have been added
If I try to ping two azure machines I cannot do that. By default azure has ping disabled so I added following firewall rule
netsh advfirewall firewall add rule name="ICMPv6" dir=in action=allow enable=yes protocol=icmpv6
but it still does not work. I think if these two machines will be able to ping each other the problem of test agent connectivity to test controller on cloud will be solved.
Reply from http://social.msdn.microsoft.com/profile/rlfh/
It won’t work as you have it now. The controller and agents have to be in different roles, but also the controller you need to install Azure Connect as an endpoint– not enabled as a role. So, you want to configure the Controller manually, then it should show up so you can add it to the Connect From list. Leave the agents as they are(azure connect as a role) and then it should work. The Roles in the Connect TO: part won’t be allowed to intercommunicate, though an endpoint can – since they have the option you selected to allow this.
My problem was solved when I manually installed Azure Connect endpoint from azure portal on the controller machine instead of enabling it as a Role in Virtual network.