Skip to content

Instantly share code, notes, and snippets.

get-cloudrive
invoke-webrequest https://github.com/Azure/AzureStack-Tools/archive/master.zip -OutFile master.zip
expand-archive master.zip -DestinationPath . -Force
cd AzureStack-Tools-master
Import-Module .\Policy\AzureStack.Policy.psm1
Get-AzureRMSubscription
#Log in to Azure account
Login-AzureRmAccount
#Get list of Azure Subscription ID's
$Subs = (get-AzureRMSubscription).ID
#Loop through the subscriptions to find all empty Resource Groups and store them in $EmptyRGs
ForEach ($sub in $Subs) {
Select-AzureRmSubscription -SubscriptionId $Sub
$AllRGs = (Get-AzureRmResourceGroup).ResourceGroupName
Login-AzureRmAccount
$SubscriptionId = (Get-AzureRmSubscription | select Name, State, SubscriptionId, TenantId | Out-GridView -Title "Azure Subscription Selector" -PassThru).SubscriptionId
Get-AzureRmSubscription -SubscriptionId $SubscriptionId | Select-AzureRmSubscription
New-NetFirewallRule -DisplayName "Allow ICMPv4-In" -Protocol ICMPv4
$vnet1Name = 'Pixel1'
$vnet1RG = 'Pixel1'
$vnet2Name = 'Pixel2'
$vnet2RG = 'Pixel2'
$vnet1 = Get-AzureRmVirtualNetwork -Name $vnet1Name -ResourceGroupName $vnet1RG
$vnet2 = Get-AzureRmVirtualNetwork -Name $vnet2Name -ResourceGroupName $vnet2RG
#Resource Lock
$LockName = "LockCloudWitnes"
$ResourceName = "pixelcloudwitness"
$ResourceType = (Get-AzureRmResource -Name $ResourceName).resourcetype
$RGName ="PIXELLAB"
New-AzureRmResourceLock -LockLevel CanNotDelete -LockName $LockName -ResourceName $ResourceName -ResourceType $ResourceType -ResourceGroupName $RGName
#Resource Group Lock
$LockName = "PIXELLABLock"
$RGName ="PIXELLAB"
#Bulk Import A Records
Import-CSV -Path "C:\scripts\arecords.csv" | ForEach-Object { New-AzureRmDnsRecordSet -Name $_.Name -RecordType $_.RecordType -ZoneName $_.ZoneName -ResourceGroupName $_.ResourceGroupName-Ttl $_.TTL -DnsRecords (New-AzureRmDnsRecordConfig -IPv4Address $_.Value) }
#Bulk Import CNAME Records
Import-CSV -Path "C:\scripts\cnamerecords.csv" | ForEach-Object { New-AzureRmDnsRecordSet -Name $_.Name -RecordType $_.RecordType -ZoneName $_.ZoneName -ResourceGroupName $_.ResourceGroupName-Ttl $_.TTL -DnsRecords (New-AzureRmDnsRecordConfig -Cname $_.Value) }
Invoke-AzureRmVMRunCommand -ResourceGroupName '<myResourceGroup>' -Name '<myVMName>' -CommandId 'RunPowerShellScript' -ScriptPath '<pathToScript>' -Parameter @{"arg1" = "var1";"arg2" = "var2"}
az aks get-credentials --resource-group PixelContainers --name PixelCluster
kubectl get nodes
az aks install-cli
az login
az aks get-credentials --resource-group PixelContainers --name PixelCluster
Install-Module PowerShellGet –Repository PSGallery –Force
Install-Module -name AzureRM.Profile -requiredversion 5.5.0
Install-Module -Name AzureRM.Security -AllowPrerelease
Import-Module AzureRM.Profile -RequiredVersion 5.5.0
Import-Module AzureRM.Security
resource "azurerm_virtual_machine_extension" "domjoin" {
name = "domjoin"
location = "${var.location}"
resource_group_name = "${var.image_resource_group}"
virtual_machine_name = "${var.prefix}"
publisher = "Microsoft.Compute"
type = "JsonADDomainExtension"
type_handler_version = "1.3"
# What the settings mean: https://docs.microsoft.com/en-us/windows/desktop/api/lmjoin/nf-lmjoin-netjoindomain
settings = <<SETTINGS