This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-AzSubscription | Foreach-Object { | |
$sub = Set-AzContext -SubscriptionId $_.SubscriptionId | |
$vnets = Get-AzVirtualNetwork | |
foreach ($vnet in $vnets) { | |
[PSCustomObject]@{ | |
Subscription = $sub.Subscription.Name | |
Name = $vnet.Name | |
Vnet = $vnet.AddressSpace.AddressPrefixes -join ', ' | |
Subnets = $vnet.Subnets.AddressPrefix -join ', ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[Parameter(Mandatory=$false)] | |
[ValidateNotNullOrEmpty()] | |
[string]$NewToken | |
) | |
Set-ExecutionPolicy Bypass -Scope Process -Force | |
Connect-AzAccount |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Clear Screen | |
cls | |
#Present a welcome screen | |
Write-Host "2bcloud RI AAD Groups Assigner v1.0" -BackgroundColor Gray -ForegroundColor Red | |
Write-Host "This script will do the following:" -BackgroundColor DarkGray | |
Write-Host "1. Check if RI_Readers and RI_Owners groups exist in AAD and if not create them." -ForegroundColor Blue | |
Write-Host "2. Assign RI_Readers group to each reservation with Reservations Reader role." -ForegroundColor Blue | |
Write-Host "3. Assign RI_Readers group to each reservation with Owner role." -ForegroundColor Blue | |
Pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Only required when running locally from your computer | |
Set-ExecutionPolicy Bypass -Scope Process -Force | |
#Install and import PSSendGrid PowerShell module: | |
if (Get-Module -ListAvailable -Name PSSendGrid) { | |
Write-Warning "PSSendGrid Module is installed" | |
} | |
else { | |
Write-Warning "PSSendGrid Module is not installed" | |
Write-Host "Installing PSSendGrid PowerShell Module.." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#STOP | |
$ShortcutPath = [System.IO.Path]::Combine($env:USERPROFILE, "Desktop", "Dalia-Stop-Hilan-VM.lnk") | |
$TargetPath = "powershell.exe" | |
$Arguments = "-NoExit -Command &{cls;Invoke-WebRequest -Method Post -Uri https://9f6a8358-7011-4c25-b760-33eb94f7f8ab.webhook.we.azure-automation.net/webhooks?token=<Azure Runbook WebHook Token>}" | |
$IconPath = "C:\Windows\UUS\amd64\WindowsUpdateImportant.ico" | |
$WScriptShell = New-Object -ComObject WScript.Shell | |
$Shortcut = $WScriptShell.CreateShortcut($ShortcutPath) | |
$Shortcut.IconLocation = $IconPath | |
$Shortcut.TargetPath = $TargetPath | |
$Shortcut.Arguments = $Arguments |