Install the OpenSSL on Debian based systems
sudo apt-get install openssl| #!/bin/bash | |
| #Create RG for storing State Files | |
| az group create --location westus2 --name dolazrg-terraformstate | |
| #Create Storage Account | |
| az storage account create --name dolazstorage2188 --resource-group dolazrg-terraformstate --location westus2 --sku Standard_LRS | |
| #Create Storage Container | |
| az storage container create --name dolazterraformdemo --account-name dolazstorage2188 |
| sudo apt-get update | |
| sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
| sudo apt-get update | |
| sudo apt-get install -y docker-ce |
| az ad sp create-for-rbac --name dolazApp --role contributor --scopes "/subscriptions/3a5ea0a9-8105-4dce-9d6e-d52d517cee2f/resourceGroups/cloudskills" --sdk-auth |
| #!/bin/bash | |
| az group create --name dolaz-aks-prod-rg --location westus2 | |
| az aks create \ | |
| --resource-group dolaz-aks-prod-rg \ | |
| --name cs-prod \ | |
| --node-count 1 \ | |
| --generate-ssh-keys |
| param | |
| ( | |
| [Parameter (Mandatory = $false)] | |
| [object] $WebhookData | |
| ) | |
| #Get service principal details from shared resources | |
| $cred = Get-AutomationPSCredential -Name 'SPCreds' | |
| $tenantId = Get-AutomationVariable -Name 'TenantId' |
| #Get service principal details from shared resources | |
| $cred = Get-AutomationPSCredential -Name 'SPCreds' | |
| $tenantId = Get-AutomationVariable -Name 'TenantId' | |
| #Auth with service principal | |
| Connect-AzAccount -ServicePrincipal -Credential $cred -Tenant $tenantId | |
| #Get all Windows VMs in the Subscription | |
| $vms = Get-AzVM | Where-Object {$_.StorageProfile.OsDisk.OsType -eq 'Windows'} |
| #Get service principal details from shared resources | |
| $cred = Get-AutomationPSCredential -Name 'SPCreds' | |
| $tenantId = Get-AutomationVariable -Name 'TenantId' | |
| #Auth with service principal | |
| Connect-AzAccount -ServicePrincipal -Credential $cred -Tenant $tenantId | |
| #Get all Windows VMs in the WebServers resource group | |
| $vms = Get-AzVM -ResourceGroupName webservers | | |
| Where-Object {$_.StorageProfile.OsDisk.OsType -eq 'Windows'} |
| function New-Sp { | |
| param($Name, $Password) | |
| $spParams = @{ | |
| StartDate = Get-Date | |
| EndDate = Get-Date -Year 2030 | |
| Password = $Password | |
| } | |
| $cred= New-Object Microsoft.Azure.Commands.ActiveDirectory.PSADPasswordCredential -Property $spParams |