0
votes

I was following the tutorial Continuous deployment with Jenkins and Azure Container Service To integrate Jenkins on Azure and set it up to work with my container registry and kubernetes.

Manually, I run the commands for creating the resource group. These commands (starting from line 10).

The command on line 26:

az vm extension set --publisher Microsoft.Azure.Extensions --version 2.0 --name CustomScript --vm-name $virtualMachine --resource-group $resourceGroup --settings '{"fileUris": ["https://raw.githubusercontent.com/Azure-Samples/azure-voting-app-redis/master/jenkins-tutorial/config-jenkins.sh"],"commandToExecute": "./config-jenkins.sh"}'

, executes the following script:

    # Jenkins
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins -y

# Docker
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce -y

# Azure CLI
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 417A0893
sudo apt-get install apt-transport-https
sudo apt-get update && sudo apt-get install azure-cli

# Kubectl
cd /tmp/
sudo curl -kLO https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

# Configure access
usermod -aG docker jenkins
usermod -aG docker azureuser
sudo touch /var/lib/jenkins/jenkins.install.InstallUtil.lastExecVersion
service jenkins restart

But I think that some configuration impacted my container registry, because I am not able to log in

$ az acr login --name myContainerRegistry error getting credentials - err: exit status 1, out: The user name or passphrase you entered is not correct.

But I can access other information from azure

$ az acr list --resource-group ResourceTest --query "[].{acrLoginServer:loginServer}" --output table
AcrLoginServer
----------------------------------
mycontainerregistry.azurecr.io
containerregistryah.azurecr.io

In some forums I read that is related with Docker, but I wonder, from Azure which changes should I do ? Should I delete the new Jenkins installation?

1
Does docker login work for you? Please try to use docker login xxx.azurecr.io -u xxxxx -p password to login it.Jason Ye
do I need to create a service principal? , which -u username and -p password, should I use?marhg
No, you can find the username and password in Azure portal. container registry -> access keys.Jason Ye
I see, I didn´t know and created a new one, should I delete it andreas-mbp:~ amhg$ az ad sp create-for-rbac --name ServicePrincipalAH --password mypssdmarhg
You want to use AAD to login ACR?Jason Ye

1 Answers

3
votes

It seems a macos issue, please follow this article to do it.

Try opening Keychain Access.app. Right-click on the login keychain and try locking it and then unlocking it again.