Showing posts with label development. Show all posts
Showing posts with label development. Show all posts

Az-204 - Prep - How To - Creating VM Using Azure Powershell

 

Hello Everyone, 

Please find below commands to create VM using azure powershell

 

# Login
Connect-AzAccount -SubscriptionName "Demo Account"

# Set your subscription
Set-AzContext -SubscriptionName "Demo Account"

# Create a resource Group
New-AzResourceGroup -Name "psdemo-rg" -Location "CentralUS"

# Create a credential to use in VM Creation
$username = 'cloud_user_p_25e585de'
$password = ConvertTo-SecureString 'c6Wh3BrR6ArHzO&Cx4cA' -AsPlainText -Force
$WindowsCred = New-Object System.Management.Automation.PSCredential ($username, $password)

# Create Windows VM
New-AzVM `
-ResourceGroupName 'psdemo-rg' `
-Name 'psdemo-win-az4' `
-Image 'Win2019Datacenter'`
-Credential $WindowsCred `
-OpenPorts 3389 `
-AzJob

Get-AzResourceGroup
# 1-83eb7c26-playground-sandbox

New-AzVM `
-ResourceGroupName "1-83eb7c26-playground-sandbox" `
-Name "psdemo-win-az1" `
-Image "Win2019Datacenter" `
-Credential $WindowsCred `
-OpenPorts 3389

New-AzVm `
-ResourceGroupName "1-83eb7c26-playground-sandbox" `
-Name "aznewvm23" `
-Location 'eastus' `
-VirtualNetworkName "mynewazvm23" `
-SubnetName "default" `
-SecurityGroupName "mynewvmNSG23" `
-PublicIpAddressName "mypublicip23" `
-OpenPorts 80,3389 `
-AsJob

Get-Job 1

$j = Get-Job -Name "Long Running*"
$j

"""
PS my_learning/az204_prep> $j = Get-Job -Name 'Long Running*'

PS my_learning/az204_prep> $j


Id Name PSJobTypeName State HasMoreData Location Command
-- ---- ------------- ----- ----------- -------- -------
1 Long Running O… AzureLongRunni… Failed True localhost New-AzVM
2 Long Running O… AzureLongRunni… Failed True localhost New-AzVM
3 Long Running O… AzureLongRunni… Completed True localhost New-AzVM
"""

Get-AzVM -ResourceGroupName 1-83eb7c26-playground-sandbox

# Get the Public IP Address
Get-AzPublicIpAddress `
-ResourceGroupName "1-83eb7c26-playground-sandbox"`
-Name "psdemo-win-az" | Select-Object IpAddress

# Remove resource group after demo
Remove-AzResourceGroup -Name '1-83eb7c26-playground-sandbox'

Az-204 - Prep - How To - Creating VM Using Azure CLI - Bash

Hello Everyone, 

Please find below commands to create VM using azure cli `az`

# login and set a subscription
az login
az account set --subscription "Demo Account"

# List all created RGs
az group list --output table

# create a RG
az group create \
--name "psdemo-rg" \
--location "centralus"

# Creating a Windows VM
az vm create \
--resource-group "1-718a377a-playground-sandbox" \
--name "psdemo-win-cli" \
--image "win2019datacenter" \
--admin-username "demoadmin" \
--admin-password "password@123" \
--public-ip-sku "Standard"

# Open RDP Port for remote access (( Might open already))
az vm open-port \
--resource-group "1-718a377a-playground-sandbox" \
--name "psdemo-win-cli" \
--port "3389"

# get the Public IP Address for remote access
az vm list-ip-addresses \
--resource-group "1-718a377a-playground-sandbox" \
--name "psdemo-win-cli" \
--output table


# Creating a Linux VM
az vm create \
--resource-group "1-718a377a-playground-sandbox" \
--name "psdemo-linux-cli" \
--image "UbuntuLTS" \
--admin-username "demoadmin" \
--authentication "ssh" \
--ssh-key-value ~/.ssh/id_rsa.pub \
--public-ip-sku "Standard"

# open port 22 ((Might open already ))
az vm open-port \
--resource-group "1-718a377a-playground-sandbox" \
--name "psdemo-linux-cli" \
--port 22

# get the public IP Address
az vm list-ip-addresses \
--resource-group "1-718a377a-playground-sandbox" \
--name "psdemo-linux-cli" \
--output table

# verify login
ssh demoadmin@52.165.189.38


# Cleanup the resources
az group delete --name "1-718a377a-playground-sandbox"

Installing Chef server in your CentOS 6.7 easily.

I have tried to install chef in my CentOS 6.7 but it was like complicated thing till today.

So many problems I have faced and I am giving them as precautions to you.

1. You should have minimum 1 Mbps unlimited connection. Atleast 5 GB data you are going to download.

2. Always you have to choose your current OS version builds, If you choose other version builds you will be stopped with library issues.

3. Atleast 6 - 7 GB of freespace

and Lot of patience.

I will give you in a simple way. Just open your terminal and turn into root user if you were not.

Then Download files from below links. Open them via browser and get the final link and download in your way.

1. https://packagecloud.io/chef/stable/packages/el/6/chef-server-core-12.3.1-1.el6.x86_64.rpm/download

2.https://packagecloud.io/chef/stable/packages/el/6/opscode-reporting-1.5.5-1.el6.x86_64.rpm/download

3.https://packagecloud.io/chef/stable/packages/el/6/opscode-push-jobs-server-1.1.6-1.x86_64.rpm/download

4.https://web-dl.packagecloud.io/chef/stable/packages/el/6/chef-sync-1.0.0~rc.7-1.el6.x86_64.rpm

5. https://packagecloud.io/chef/stable/packages/el/6/chef-manage-2.1.1-1.el6.x86_64.rpm/download

6. https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chefdk-0.10.0-1.el6.x86_64.rpm


After download all these files place them in any directory.

Now let us assume these files are in /home/mypc/chef directory.


Step 1:

rpm -ivh chef-server-core-12.3.1-1.el6.x86_64.rpm

chef-server-ctl reconfigure

chef-server-ctl user-create rajachef Raja G raja@myserver.com  abc123 --filename /home/virt01/userkey.pem

Original Syntax : $ chef-server-ctl user-create user_name first_name last_name email password --filename FILE_NAME

chef-server-ctl org-create virt02 "virt02.myserver.com." --association_user virt02 --filename /home/virt02/virt02-validator.pem

Original Syntax: $ chef-server-ctl org-create short_name "full_organization_name" --association_user user_name --filename ORGANIZATION-validator.pem

Step 2: 


chef-server-ctl install opscode-manage --path /home/mypc/chef/chef-manage-2.1.1-1.el6.x86_64.rpm

chef-server-ctl reconfigure

opscode-manage-ctl reconfigure

Step 3: 

chef-server-ctl install opscode-push-jobs-server --path /home/mypc/chef/opscode-push-jobs-server-1.1.6-1.x86_64.rpm

chef-server-ctl reconfigure

opscode-push-jobs-server-ctl reconfigure

Step 4:

chef-server-ctl install chef-sync --path /home/mypc/chef/chef-sync-1.0.0~rc.7-1.el6.x86_64.rpm

chef-server-ctl reconfigure

chef-sync-ctl reconfigure

Step 5: 


chef-server-ctl install opscode-reporting --path /home/mypc/chef/ opscode-reporting-1.5.5-1.el6.x86_64.rpm

chef-server-ctl reconfigure

opscode-reporting-ctl reconfigure

Step 6:


And now install Chef Development Kit.

rpm -ivh chefdk-0.10.0-1.el6.x86_64.rpm

That's it chef server successfully installed in your system. To access chef , just open your browser and type localhost or IP of your PC. And you will get Login page and login with those credentials given initially at Step 1. 

If you are facing any issues please dont hesitate to ask. 

Thank you.

Regards
Raja