Setup Chef Server on Microsoft Azure
This is the second post in the Chef and Microsoft Azure blog series. You can read the first blog in this series at https://manesh.me/2015/10/17/setup-chef-workstation-on-microsoft-azure/
In this blog, I am exploring how to setup a Chef Server on Microsoft Azure. For most part, I followed the steps suggested in https://docs.chef.io/azure_portal.html
- Microsoft Azure Subscription
- Create Virtual Machine
- Set DNS Name Label for virtual machine
- Configure Chef Server
- Create Organization
- Establish Connectivity from Workstation
Create Virtual Machine
Navigate to https://portal.azure.com and login using your credentials.
Click New, then Compute, then Marketplace
Search for Chef Server, then select Chef Server 12, BYOL.
Note: Chef provides a fully functional Chef server that can be launched from the Azure Marketplace. This server is preconfigured with Chef Server, the Chef Management console, Chef reporting, and Chef Analytics. This configuration is free to use for deployments under 25 nodes, and can be licensed for deployments beyond 25 nodes.
Choose Resource Manager as the deployment model and click Create
Provide basic settings and click OK.
Click Size, then A5 Standard, then Select
Click Settings and then OK. Choose the default options, unless you want to change something.
Click Summary, review summary and click OK
Click Buy on left menu, review offer details and click Buy button
Wait for the newly created server to be in Running state.
Set DNS Name Label for virtual machine
Click Virtual machines, then mme-chef-server
Click on IP Address
Click on Settings, then Configuration
Update DNS name label and click Save
DNS name for the virtual machine in this case is ‘mme-chef-server.southcentralus.cloudapp.azure.com’. Wait for 5 minutes and check if you are able to ssh to the server using ‘ssh email@example.com‘
Configure Chef Server
Open Git Bash and run the following commands.
|# Here chefadmin is the admin user created during virtual machine creation.
# Provide DNS name label of the virtual machine
#sudo chef-setup -u <username> -p <password> -d <fqdn>
#Here username is a new user, which will be created in this process.
# You will use this username to connect form portal
sudo chef-setup -u admin -p Demo@Pass1 –d mme-chef-server.southcentralus.cloudapp.azure.com
Enter Username (specified during chef-setup), Password (specified during chef-setup) and click Sign In
Click Create New Organization
Provide Full Name, Short Name, then click Create Organization
Click on Administration, then Organizations, then contoso
Click Starter Kit, then Download Starter Kit
Save chef-starter.zip locally. In my machine (Windows Laptop), it saved by default in the Downloads folder.
Establish Connectivity from Workstation
Copy the downloaded chef-starter.zip from local machine to Chef Workstation (I am copying it to workstation, I created as per the first blog in this series). I used the following command to copy the file from Git Bash. You might have to change according to your environment.
|scp Downloads/chef-starter.zip firstname.lastname@example.org:/home/azureuser|
SSH into workstation
Execute following commands to get SSL keys and test connection to Chef Server
|# move to home directory of azureuser
# install unzip utility
sudo apt-get install unzip
# unzip the starter kit
# move to chef-repo directory
# retrieve SSL keys from server
knife ssl fetch
# test connection to server, we should see contoso-validator
knife client list
Next, I will try out adding a Chef Node to the organization and running cookbooks.