Skip to main content

Configure Azure PowerShell

· 2 min read

Using the Azure Portal to create and manage resources can be beneficial for one-off tasks and learning about different services offered in Azure; however, it becomes more practical to take advantage of a scripting language such as PowerShell for management of tasks as it allows the use of one-liner syntax, piping outputs, and scripting.

Configure Active Directory using PowerShell

· One min read
New-Item -Path "c:\" -Name "PowerLab" -ItemType "directory"
'P@$$w0rd12' | ConvertTo-SecureString -Force -AsPlainText | Export-Clixml -Path C:\PowerLab\SafeModeAdministratorPassword.xml

$safeModePw = Import-Clixml -Path C:\PowerLab\SafeModeAdministratorPassword.xml

Install-windowsfeature -Name AD-Domain-Services

$forestParams = @{
DomainName = 'techuplab.local'
DomainMode = 'WinThreshold'
ForestMode = 'WinThreshold'
Confirm = $false
SafeModeAdministratorPassword = $safeModePw
WarningAction = 'Ignore'
}

$null = Install-ADDSForest @forestParams

Azure Managed Identities

· 3 min read

Managed identities can be used to manage Azure resources without using hardcoded credentials - removing the need to enter credentials from a VM (or other resources such as Azure Functions) that are accessing resources the managed identity has been given access to. There are two types of managed identities - User Assigned and System Assigned. User assigned can be used by multiple resources and system assigned is tied to one specific VM (resource). User assigned is created as a Managed Identity that can be assigned to multiple VMs.