Skip to content

Instantly share code, notes, and snippets.

PixelRobots

Block or report user

Report or block PixelRobots

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View encryptvmss.ps1
$KVRGname = 'PixelRobots-KV-UKS';
$VMSSRGname = 'PixelRobots-VMSS-UKS';
$VmssName = 'pixelrobotsvmss';
$KeyVaultName = 'PixelRobots-VMSS-KV-UKS';
## Do not edit below this line.
$KeyVault = Get-AzKeyVault -VaultName $KeyVaultName -ResourceGroupName $KVRGname;
$DiskEncryptionKeyVaultUrl = $KeyVault.VaultUri;
$KeyVaultResourceId = $KeyVault.ResourceId;
Set-AzVmssDiskEncryptionExtension -ResourceGroupName $VMSSRGname -VMScaleSetName $VmssName -DiskEncryptionKeyVaultUrl $diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $KeyVaultResourceId;
View AzureSubscriptionRBACAudit.ps1
#requires -Version 3.0 -Modules Az.Resources
param(
[switch]
$email
)
$ErrorActionPreference = 'Stop'
## Email Style
View Delete_Empty_RGs_Azure.ps1
#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
View azure disk alert
// enter a GB value to check
let setgbvalue = 100;
// Query
Perf
| where TimeGenerated > ago(1h)
| where ObjectName == "LogicalDisk" and CounterName == "Free Megabytes"
| where InstanceName !contains "D:"
| where InstanceName !contains "_Total"
| extend FreeSpaceGB = CounterValue/1024
| summarize FreeSpace = min(FreeSpaceGB) by Computer, InstanceName
View AzureSubscriptionSelector.ps1
function Login {
$needLogin = $true
Try {
$content = Get-AzContext
if ($content) {
$needLogin = ([string]::IsNullOrEmpty($content.Account))
}
}
Catch {
if ($_ -like "*Login-AzAccount to login*") {
View domjoin.tf
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
View Azure Security Center Preview Cmdlets.ps1
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
View AKS_part1.ps1
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
View Azure_Run_Command.ps1
Invoke-AzureRmVMRunCommand -ResourceGroupName '<myResourceGroup>' -Name '<myVMName>' -CommandId 'RunPowerShellScript' -ScriptPath '<pathToScript>' -Parameter @{"arg1" = "var1";"arg2" = "var2"}
View Bulkadd_AZ_DNS.PS1
#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) }
You can’t perform that action at this time.