This file contains 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
Login-AzAccount -UseDeviceAuthentication | |
Get-AzContext | |
$VMs = @() | |
$RGs = Get-AzResourceGroup | |
foreach($RG in $RGs) | |
{ | |
$VMs += Get-AzVM -ResourceGroupName $RG.ResourceGroupName -Status | |
} | |
# Take out the # at the end of the next line if you want to output to csv |
This file contains 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
// Great feature to provide temporary access using PIM | |
// https://scriptautomaterepeat.com/privileged-access-management/?fbclid=IwAR1iub0C2L6Jt0oYpADDotjoKLwXHwQWQGoMxcaOYOA6Nqsu0dxdqGgdKp8 | |
// Example 1 | |
$Time = New-TimeSpan -Minutes 15 | |
Add-ADGroupMember -Identity "TESTGroup1" -Members "tstuser" -MemberTimeToLive $Time | |
//Example 2 |
This file contains 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
# Querying Azure at scale -- | |
# Make sure to install this module - there is currently only one command available inside this module - 'search' | |
# The advantage of using this module is that is will query across subscriptions without needing to define them | |
#Install-Module -Name Az.ResourceGraph | |
#Get-Command -Module Az.ResourceGraph | |
#Login-AzAccount -UseDeviceAuthentication |
This file contains 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
# Discover VM extensions available in a Region - change out EastUS2 to the region you need | |
# Windows VM's | |
# https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/features-windows#run-vm-extensions | |
Get-AzVmImagePublisher -Location "EastUS2" | Get-AzVMExtensionImageType | Get-AzVMExtensionImage | Select Type, Version | |
# Linux VM's | |
# https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/features-linux |
This file contains 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
#credits: Mostly to tobibeer and Snak3d0c @ https://stackoverflow.com/questions/47345612/export-chrome-bookmarks-to-csv-file-using-powershell | |
#Path to chrome bookmarks | |
$pathToJsonFile = "$env:localappdata\Google\Chrome\User Data\Default\Bookmarks" | |
$htmlOut = 'C:\temp\ChromeBookmarks.html' | |
$htmlHeader = @' | |
<!DOCTYPE NETSCAPE-Bookmark-file-1> | |
<!--This is an automatically generated file. | |
It will be read and overwritten. | |
Do Not Edit! --> |
This file contains 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
#Login-AzAccount | |
Get-AzSubscription | |
Select-AzSubscription -SubscriptionId SubscriptionIdHere | |
Get-AzPublicIpAddress | select -Property *name,@{name='sku';e={$_.sku.name}} | |
# Loop through all Subscriptions that you have access to and export the information | |
Get-AzSubscription | foreach-object { | |
This file contains 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
# https://support.microsoft.com/en-us/help/2619062/you-can-t-manage-or-remove-objects-that-were-synchronized-through-the | |
# Connect to AAD | |
Connect-MsolService | |
# Disable AAD Connect Sync atAAD Level -- This will set users to be Cloud Only | |
Set-MsolDirSyncEnabled -EnabledDirSync $false | |
# To Check the Status of the previous command, run the following command | |
(Set-MsolDirSyncEnabled).DirectorySynchronizationEnabled |