Tuesday, November 8, 2016

Deploy a Jenkins Docker VM in Azure

    Azure provides a lot of VM templates which enables you to quickly create and configure a machine matching with your needs.

    In this tuto, you are going to setup a VM with a Jenkins services hosted in a Docker container.

    Time : 20 minutes

    Prerequisites :

    • Putty
    • Azure subscription

1. Connect to Azure management Portal (https://portal.azure.com)

    clip_image001

2. Select Jenkins docker template and click on "Create" button

    clip_image002

    clip_image003

3. Fill in the configuration form. You can generate a SSH key with PuttyGen or any other tool or you can just type a password.

    clip_image004

4. Select the machine type

    clip_image005

5. You can configure advanced features if required, else, click OK

    clip_image006

6. You're almost done, click ok. It will take a few minutes to Azure to provision the VM

    clip_image007

7. Once the VM is created, you can retrieve its public IP. By default, a Jenkins server is configured to be accessed through ports 8080 and 22

    Copy the public IP

    clip_image008

8. Open a web browser and type the Jenkins url like http://12.123.12.123:8080

9. You should get this page

    clip_image009

10. Now we should get the Administrator password. It is not the one you entered when creating the VM. It is another hosted in the VM file system.

11. Open Putty and initiate a connection to this machine

    clip_image010

12. You will be prompted for your credentials. Enter the credentials configured when creating the machine.

13. You are now connected !

    clip_image011

14. Let's find the admin password now ! Since you are on a Docker VM, you need to get root access to find the file.

15. Run this command and set a root password

    sudo passwd root

16. Connect as root

    su -

17. Now your prompt should look like that :

clip_image012

18. find / -name 'initialAdminPassword'

19. You should get the path of the initial admin password file

20. Open it with nano

    clip_image013

21. You're done ! Go back to the Jenkins page on your Web browser and enter this code.

    clip_image014

22. At this step, you should feel like a hacker! Install the suggested plugins

    clip_image015

23. At the end of Jenkins config, create the admin user

    clip_image016

24. Well done! Your Jenkins is ready!

    clip_image017

How to add a Jenkins Build in VSTS?

    Visual Studio Team Services now provides a large set of features and third party tools integration that allows developers to "come as they are" and leverage the tools they master.
    Some teams already invest in DevOps and release management with third party tools like Jenkins or Maven and want to manage their work items in TFS. It is now possible by configuring an endpoint connection in VSTS.
    Prerequisites:
    • Jenkins server available and configured
    1. Create VSTS with Git Source control
    clip_image001


clip_image002
2. The project is created! Then, go to build and create a new build definition
    clip_image003
3. Select the Jenkins Build Template
    clip_image004
4. Here you can select from which source control this build definition will be connected. Select the Git Source control from your VSTS team project. Select the master branch
    clip_image005
5. Now, we've got 2 main steps in the build. The first queue the build on your Jenkins server. The second download the results and save them to the VSTS staging directory
    clip_image006
6. Now we need to connect to a Jenkins Endpoint. If no endpoints has been registered yet, click on "Manage"
    clip_image007
7. A new tab is going to be opened. In the "New Service Endpoint" Drop down list, select Jenkins
    clip_image008
8.Enter the following parameters:
    Connection Name: The name of this Endpoint (up to you)
    Server URL: Url of your Jenkins Server (For instance http://52.169.74.152:8080/)
    Accept untrusted SSL certificates (if Jenkins server connection is encrypted)
    Username
    Password
    Click on Verify Connection and OK
    clip_image009





9.Go back to the build setup and refresh the service Enpoint drop down
    clip_image010
10. It should now display the newly created Jenkins Endpoint
    clip_image011
11. Then, enter a job name. This job will be the one queued in Jenjins by the build definition
    clip_image012
12. Optional : You can send parameters to the Jenkins Job is needed
13. Configure the Download artifacts step with the Same Endpoint and Job name.
    clip_image013
14. Save everyhing and your build definition is ready !
    clip_image014
15. Once your build definition has been saved, you can queue a New Build
    clip_image015
clip_image016
    Remarks:
    • If no code has been uploaded to the source control, the build may fail
    Next steps:
    Once you configured this build, you can go further by adding SonarQube build steps to your build definition

Thursday, May 15, 2014

TFS 2010 Version numbers

Preparing a migration to TFS 2013, I was looking for the current version of TFS 2010.

This is the list of TFS 2010 versions:

10.0.30319.1 - TFS 2010 RTM
10.0.40219.1 - TFS 2010 with Service Pack 1
10.0.40219.371 - TFS 2010 with Service Pack 1 and Cumulative Update 2

Friday, March 14, 2014

[Dynamics AX Retail] Cannot proceed to catalog publishing because channel has not been published successfully. Channel publishing status: Failed. Status message: 'Object reference not set to an instance of an object.'

I faced this issue while installing the retail online storefront on my dev machine. To fix it, perform the following steps (in this order !)

1. Retail -> OnlineChannel -> "your channel"

2. Edit

3. In the top ribbon, click on Setup -> Distribution locations

clip_image001

4. Ensure that the distribution location form is properly filled in

5. Then, functions -> Test connection

6. {The following pop up should be displayed}

clip_image002

7. Go back to the distribution location form and click Functions->Send Configuration

clip_image003

8. The following pop up should appear indicating that the configuration has been pushed to the sync service

clip_image004

9. Close distribution locations form

10. Go back to online channel screen

11. Click on channel->Publish

clip_image005

12. The publishing status of the channel should be set from "draft" to "In Progress"

13. Go back to the retail area page

14. Run Periodic -> Data distribution -> Create Actions job (and click ok)

clip_image006

15. Then, Periodic -> Data distribution -> distribution schedule

clip_image007

16. Select the job N-1075_OC

Ensure that the distribution location list is properly setup. If it is empty, no data will be synchronized to the retail database…

clip_image008

17. Run the job N-1075_OC (Click Run Directly)

18. On the DB Server where the retail database is deployed, open SQL Server Management Studio and run the following query

SELECT *

FROM [SyncServiceMsg].[dbo].[IncomingMessages]

ORDER BY PackageNo desc

This query displays the list of job queued on the retail database. The latest job should be N-1075_OC

clip_image009

19. Now, on the SharePoint machine, open a powershell prompt and type the following script.

I consider here that the RetailPublishing job is properly deployed on your machine and runs every minutes.

Add-PSSnapin Microsoft.SharePoint.Powershell

$maxHistory = 1;

$job = Get-SPTimerJob | Where { $_.Name -eq "RetailPublishingJob"}

$i = 1;

foreach($hist in $job.HistoryEntries)

{

$hist

$i++

if($i -gt $maxHistory)

{

break

}

}

The result should be something like this:

clip_image010

Tuesday, November 27, 2012

The file does not contain valid publish settings for Windows Azure

Today, while trying to add a new Azure Cloud Service Project, I got an error when configuring my Azure profile. The message told me that the profile file freshly downloaded from Azure website was invalid and cannot be used in the Azure Project…

image

I’ve found in the Azure Tools 1.8 release not that the publishingsettings profile schema has been updated in this release and if your Azure website has been created with a previous release, the publishing profile file cannot be used in a 1.8 Azure project…

http://msdn.microsoft.com/en-us/library/windowsazure/ff683673.aspx#BK_October2012

“The format of .publishsettings files have changed with this release. You can't use an earlier version of the Windows Azure Tools to open a .publishsettings file that was created with the 1.8 version. You can use the 1.8 version to open .publishsettings files that were created with earlier versions of the tools. You can determine whether a .publishsettings file uses the new format by opening it in a text editor and looking for the SchemaVersion element. If the file contains the element<SchemaVersion="2.0">, the file is in the 1.8 format. If you try to use an earlier version to open a file that's in the 1.8 format, the file fails to open, and the following error message appears: The file File.publishsettings does not contain valid publish settings for Windows Azure.”

Solution:

- Create a new Azure Website

- Enter the profile parameters manually instead of using the publishing profile file.

Hope this helps !

Friday, November 16, 2012

Get Active Directory Group Members with PowerShell

I’ve not blogged for quite a while. Let’s come back with a small PowerShell script for retrieving Active Directory Group Members.

The bellow scripts retrieve all the Active Directory groups in a specific OU and count the number of members.

Import-Module ActiveDirectory

$groups = Get-ADGroup -searchbase "OU=MyOU,DC=myDC,DC=net" -filter *

$myArray = @()

foreach($g in $groups)

{

$members = Get-ADGroupMember($g)

$myObject = New-Object System.Object

$myObject | Add-Member -type NoteProperty -name Name -Value $g.Name

$myObject | Add-Member -type NoteProperty -name Count -Value $members.Length

$myArray += $myObject

}

$myArray


 

Wednesday, June 20, 2012

How to enable kerberos authentication on your SharePoint Website

Open the central admin website

Go to web application management, select your website and click on authentication providers

clip_image001

Select the provider you want to modify

clip_image002

Change the NTLM to Negotia (Kerberos) authentication mode

clip_image003

Run inetmgr, select your website and configure the authentication providers

clip_image004

Right click on Windows Authentication and select providers

clip_image005

Add the Negociate:Kerberos authentication mode to the list of enabled providers

clip_image006

Move the Negociate:Kerberos provider to the top of the list

clip_image007

Right click on Windows Authentication and select advanced settings

clip_image008

In the extended protection drop down list, select "Accept" and check the "Enable Kernel-mode" authentication checkbox

clip_image009

Now, you can connect to the website using kerberos authentication !