Swap Azure Agent to Service - azure-devops

Is there a clean way to swap an azure agent to run as a service. When I installed it I decided to install to have run manually. As time has gone on the need to convert to a service is becoming bigger and bigger. Is there an easy way to convert it over to a service without having to reinstall an agent?
Could always just tell windows to run it as a service which I imagine would work, but any other thoughts.
Thanks.

We could configure the self-hosted to run interactively or run as a service, if you have configured it run interactively, we can't change the way it works, if you want to change it, we need to remove and re-configure an agent
To remove the agent:
.\config remove
After you've removed the agent, you can configure it again.

Related

Running UI test in Jenkins Docker-Slave

With the use of Jenkins Docker Plugin we can provision the slaves dynamically.
My need is to run UI tests on the automatically created slaves. Is that feasible? If yes, how can we achieve that?
UI tests are WindowTester test cases for eclipse based tool.
I am doing same kind of stuff, On successful build we are running all automated test cases on windows machine.
In your Jenkins, you need to add Windows machine as a Slave machine.
Try below tutorial -
https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines+on+Windows
Once node is up and running then in your Job make sure you selected windows slave node.

VSTS Agent Auto Update fails to update

Reading the VSTS documentation about Build and Release Agents, that says:
Each agent automatically updates itself when it runs a task that requires a newer version of the agent. But if you want to manually update some agents, right-click the pool, and then click Update all agents.
That doesn't work for me.
I tried to "right-click the pool, and then click Update all agents", the status change to "Downloading version ....". But I can't see any change with the agent.
Every time, I have to uninstall the agent, download the new version and reinstall it again. I've checked directory permissions and everything looks fine. The agents are installed on a Windows Server 2012 x64.
Any idea?
It takes some minutes (per to the environment, such as network) to update the agent and will be restarted automatically, then you can check the Agent.Version value in Capabilities.
Are your agents in a machine behind a proxy?
In this case, you need to configure the proxy:
Add a file named .proxy in the root folder where the agent is installed
Write as content the proxy address to be used, for example http://192.168.0.1:1234
If your proxy needs authentication, you must set these environment variables:
set VSTS_HTTP_PROXY_USERNAME=user
set VSTS_HTTP_PROXY_PASSWORD=password
Restart the agent service to apply the change
The agent should now be able to connect to internet and download to apply the update.

Updating Deployments SCCM

I'm super new to SCCM and trying out some stuff.
Atm I create a lot of Applications to deploy on around 50 Clients.
Before I deploy them to all clients I test them on a test Client.
The problem now is that if I change sth in the Deployment Type like the installation command I have to delete the deployment everytime afterwards and deploy it again or the change wont happen on the client when I install the Application next time.
There probaly a way easier method which I can't figure out atm.
So how do i update the changes I made after the Application is allready deployed?
Greetings,
Paxz.
The application deployment command line will only be executed if the application is not detected - i.e. the Application Detection criteria evaluates to false. With this premise, it is possible to change the Application Detection criteria so it evaluates to false... perhaps add an addition rule to include "file1.txt exists"? This should work, but it is ugly and I would not recommend it.
A better approach
I prefer to test my application deployments on VMs in the first instance: prepare the destination machine, snapshot it, then deploy.
If you need to tweak your deployment you can then make the required changes, redistribute the content (if required), then restore the VM's snapshot for a fresh deployment.
I managed to get an answer from microsofts technet forum.
For deployments to know the update in the command line, I just have to push the next policy polling cycle.
This will only be effective for clients that haven't executed the deployment type yet.
Other than that there seems to be no other way than deleting the deployment and re-deploying it for the changes to be known for the deployment.

TFS 2012: Is it possible to restart a Build Agent programmatically?

I'm looking for the way to restart build agent with powershell script. If anyone knows the way in c# that's fine I can translate.
I know I can easily restart Build Service with two lines of code.
Pointing me in right direction is all I need.
I don't believe there is a way to programmatically restart the 2012 build agent. If your build agent is set to autostart you could reboot the box using PowerShell.
There isn't any way to do this via TFS API. SetBuildAgentStatus is used to set the build agent status to following: Available, Offline and Unavailable.

Why do we need to restart the CRM server after registering the custom workflow using Plugin Registration tool to make that work properly

Can we have any alternative way to make run-able the custom Workflow activity in Workflow steps.
All the time what I do is register the dll using Plugin registration tool and then restart the server. Then only we can use the custom workflow activity on Workflow.
I have tried after restarting the IIS and hoping so it'll be done but no luck.
All the time restarting server should not be any solution. Is there any alternative way for it please suggest. All you are suggestion would be greatly appreciated.
1) You do not need to restart IIS; restart the application pool (its far faster and doesn't disrupt other applications that might be running on the server; by default its the 'CrmAppPool') using the command:
%systemroot%\system32\inetsrv\appcmd recycle apppool CrmAppPool
2) Similarly, you can recycle the async process by running (powershell):
Restart-Service -displayname "Microsoft Dynamics CRM Asynchronous Processing Service"
3) Both of these commands can be run remotely using the powershell command:
powershell Invoke-Command [CrmServerName] -ScriptBlock { ["Restart-Service...."] }
4) You do not need to deploy to the server to debug plugins. Its far easier/faster to create a test harness. The link below outlines how to setup a dev environment for unit testing.
How I develop and unit test CRM 2011 plugins
CRM caches the dlls, restarting the services causes it to refresh those caches.
If you register a synchronous plugin then you need to reset IIS.
If you register an asynchronous plugin or custom workflow activity you need to reset the asynchronous service.
We don't need to restart the server to make it run the plug-in code, the only thing is you need to restart IIS after that.
Try restart IIS and then restart the asynchronous service, this must be the only thing necessary.
The point here is very specific -
It's not only true for the CRM, but is also true for any web application hosted on IIS. Web App (CRM for you case) caches dlls for the very first time when the message is executed (plugin message/event - Although this is done by .net platform internally, so to address the other similar calls more efficiently.). So, in that case you need to flush off the synced thing from your web app. And that is why you need to recycle app pool (SMART WAY -> for single application flush, and without impacting other applications on the server, you should always go for APPPOOL Recycle instead to IIS restart.)
For this, what I would suggest you is to write a powershell script to recycle AppPool for your application and trigger it on Post build event of your project (plugin project) in VS. So, that will make your process automated and will reduce your efforts to much lesser.
Regarding custom WF assembly, Since it executes under Async. Service, so you need to discard off the cached content from here as well.
Hope this helps!
You shouldn't need to restart anything.
What you need to do is increment the build number of the assembly you are updating each time you deploy it.
This makes sure that CRM knows not to use it's cached version but to load the updated one the database
If you want to see the CWAs without any need of restarts just select the activity in the plugin registration tool and press the "save" button below the properties