automate-azure-tasks-using-scripts
Decide if azure powershell is the right tool for azure admin tasks install azure powershell on different OS connect to an azure subscription using azure powershell create azure resources using azure powershell
CRM - Customer Relationship Management
Azure powershell and the Azure CLI support automation, but azure portal doesnt
Azure portal doesnt require you to learn syntaz or memorize commands, tasks can be done quickly without any commands or syntax
Cmdlets follow a verb-noun naming convention
Cmdlets are shipped in modules. A powershell module is a dll that includes the code to process each available cmdlet. You load cmdlets into powershell by loading the module in which they are contained. You can get a list of loaded modules using the "Get-Module" command
install Az module in powershell
in general there are four steps user need to perform while creating resources via powershell
Import the azure cmdlets
connect to azure subscription
create resource group
verify that creation was successful
In powershell, you can only be in one subscription at a time. use Get-AzContext
cmdlet to determine which subscription is active. If its not the correct one, you can change subscriptions using another cmdlet.
Create an azure virtual machine
Azure powershell provides the New-AzVM
cmdlet to create a new virtual machine.
This cmd has many parameters to let it handle the large number of VM configuration settings. Most of the parameters have reasonable default values, so we only need to specify five things
ResourceGroupName - resource group into which the new VM should be placed.
Name - the name of the VM
Location - geographic location of where the VM is provisioned
Credential - object containing the username and password for the VM admin account.
Image - the OS image to use for VM
Last updated