Skip to content

Instantly share code, notes, and snippets.

Esmaeil Sarabadani esarabadani

Block or report user

Report or block esarabadani

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 VMSS_Managed_OS_Disk.ps1
#Deploys a Virtual Machine Scale Set (with OS managed disk from an image) with an internal load balancer in front of it
#refer to this blog post for more information: https://wp.me/p9qR9L-5e
$Credential = Get-Credential
Add-AzureRmAccount -Credential $Credential
Select-AzureRmSubscription -SubscriptionId "Put your subscription ID here"
#This is your resource group in which your image, and all your other resources are located
View Update_VMSS_Instances.ps1
$vmssObject = Get-AzureRmVmss -ResourceGroupName $greenrg -VMScaleSetName $vmssName
$vmssObject.virtualMachineProfile.storageProfile.osDisk.image.uri= $newImageURI
$instances = Get-AzureRmVmssVM -VMScaleSetName $vmssName -ResourceGroupName $greenrg
foreach($instance in $instances){
Update-AzureRmVmssInstance -ResourceGroupName $greenrg -VMScaleSetName $vmssName -InstanceId $instance.InstanceID
}
View Create_VMSS_with_Manual_Upgrade_Policy.ps1
Add-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId "Put your Azure Subscription ID here"
$greenrg = "bluegreen" #Enter the name of your resource group here
$loc = "West Europe" #Enter the region of your choice here
$vnetname = "bgvnet" #Enter the virtual network name here
$backendSubnetName = "subnet1" #This is the name of your subnet in the virtual network
$LBFrontendNewPrivateIPAddress = "10.1.0.6" #This is the frontend IP Address of your internal load balancer. Make sure it is in the same range as your subnet
$stName = "bgvmss" #This is the storage account name (for the scale set)
$vmssName = 'esmaeilbgvmss'; #This has to be a unique name and needs to be changed with every redeployment
View Get-Subscription-Users.ps1
Login-AzureRmAccount
$subs = Get-AzureRmSubscription
foreach($sub in $subs)
{
$subID = $sub.SubscriptionId
Write-Output("`nSubscription Name: " + $sub.SubscriptionName + "`n")
$substring = "/subscriptions/" + $subID
Get-AzureRmRoleAssignment -IncludeClassicAdministrators -scope $substring | FL SignInName
View Azure-API-PowerShell.ps1
#Login to Azure
Add-AzureRmAccount
#Select Azure Subscription
$subscription =
(Get-AzureRmSubscription |
Out-GridView `
-Title 'Select an Azure Subscription ...' `
-PassThru)
View EnableMFA.ps1
#This script will enable Multi-Factor Autentication for all your Azure Users... This script also requires users to use MFA when using Office365
Connect-MsolService
Login-AzureRmAccount
$subs = Get-AzureRmSubscription
$st = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement
$st.RelyingParty = "*"
$st.State = “Disabled”
View Add-User-to-Every-Azure-Subscription.ps1
Login-AzureRmAccount -Credential $Credential
Connect-MsolService -Credential $Credential
$subs = Get-AzureRmSubscription
foreach($sub in $subs)
{
$subID = $sub.SubscriptionId
Write-Output("`nSubscription Name: " + $sub.SubscriptionName + "`n")
Select-AzureRmSubscription -SubscriptionId $subID
View EnableMFA-Azure-Runbook.ps1
$azureCredential = Get-AutomationPSCredential -Name "AzMonkey"
if($azureCredential -ne $null)
{
Write-Output "Attempting to authenticate as: [$($azureCredential.UserName)]"
}
else
{
throw "No automation credential name was specified..."
}
You can’t perform that action at this time.