Are you or your team using the Azure Portal? But everyone say use PowerShell? Or perhaps JSON?
Let’s start with a PowerShell Script, that will let you connect to Azure Resource Manager (AzureRM).
#Get connected to your Azure Subscription. #Install Azure RM Commands. Install-Module AzureRM #Import Azure RM Commands. Import-Module AzureRM #Login to AzureRM. Login-AzureRmAccount #See which Azure RM Subscription your currently managin. Get-AzureRmContext #Get a view of all Azure RM Subscriptions your account is administrating. Get-AzureRmSubscription #Select a subscription by copying the SubscriptionName. Get-AzureRmSubscription –SubscriptionName "MSDN-plattformer" | Select-AzureRmSubscription
https://github.com/RoyApalnes/Microsoft/blob/master/ConnectoToAzureRMSub.ps1
Then we need to create the initial structure, which will be reused and going forward is static values. Basically we create a Resource Group, a Storage Account, a Virtual Subnet and a Virtual Network.
#Variables #Datacenter location $locName = "northeurope" #Resource Group Name $rgName = "DEMO" #Storage Account $stName = "itiscloudydemo01" #Virtual subnet $subnetName = "itiscloudydemo" #Virtual network $vnetName = "itiscloudydemo" #Create a Resource Group New-AzureRmResourceGroup -Name $rgName -Location $locName -Force #Create a Storage Account $storageAcc = New-AzureRmStorageAccount -ResourceGroupName $rgName -Name $stName -SkuName "Standard_GRS" -Kind "Storage" -Location $locName #Create a Virtual Network Subnet $singleSubnet = New-AzureRmVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24 #Create a Virtual Network $vnet = New-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $rgName -Location $locName -AddressPrefix 10.0.0.0/16 -Subnet $singleSubnet
https://github.com/RoyApalnes/Microsoft/blob/master/StartAzureInfrastructure.ps1
See my next post with two PowerShell scripts to manage new Azure RM Virtual Machines, either by editing the PowerShell variables or being prompted for input to the variables.
Leave a Reply
You must be logged in to post a comment.