login to tenant
Install-Module Az
Import-Module Az
Connect-AzAccount
change subscriptions
Set-AzContext -Subscription “5cf7452e-….”
Create a new Resource Group container
$ResourceGroupName = “allen-tf-sandbox”
$location = “southafricanorth”
New-AzResourceGroup -Name $ResourceGroupName
-Location $location -Tag @{CustomerName="Customer01";
AutoShutdownSchedule=”None”; `
Environment=”sandbox”;}
st.acc variables
$StorageAccName = ‘devopssandboxterraf01’
$StorageType = ‘Standard_LRS’
create your storage account
New-AzStorageAccount -ResourceGroupName $ResourceGroupName
-Name $StorageAccName -Type $StorageType
-Location $location -Tag @{CustomerName="Customer01";
AutoShutdownSchedule=”None”; `
Environment=”sandbox”;}
create your container
$azstorageacc = Get-AzStorageAccount -ResourceGroupName $ResourceGroupName -Name $StorageAccName
$NewContainerName = ‘terraform’
$CTX = $azstorageacc.Context
New-AzStorageContainer -Name $NewContainerName -Context $ctx
Get the storage account access keys
Get-AzStorageAccountKey -ResourceGroupName $ResourceGroupName
-Name $StorageAccName