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
param( | |
[String] $destinationUri = "https://[YOUR STORAGE ACCOUNT NAME].blob.core.windows.net/vhds", | |
[String] $destinationKey = "[YOUR STORAGE ACCOUNT KEY]", | |
[String] $sourceAccountPattern = "*disk*", | |
[String] $pathToAzCopy = "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe" | |
) | |
clear | |
Login-AzureRmAccount -EnvironmentName AzureGermanCloud | |
$storageAccounts = Get-AzureRmStorageAccount |
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-AzureRmAccount | |
cls | |
$subs = Get-AzureRmSubscription | |
ForEach ($sub in $subs) | |
{ | |
Write-Host 'ARM: VPN Gateways in subscription' $sub.SubscriptionName '(' $sub.SubscriptionId ')' | |
Select-AzureRmSubscription -SubscriptionName $sub.SubscriptionName -OutVariable out | |
$gwr = Find-AzureRmResource -ResourceType "Microsoft.Network/virtualNetworkGateways" | |
if ( $gwr -ne $null) | |
{ |
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
$errConnections = Get-AzureRmResource -ResourceGroupName RG-Development ` | |
-ResourceType "Microsoft.Web/connections" -ExpandProperties | | |
Where-Object { $_.Properties.Statuses.Status -eq "Error" } | |
$errConnections.Count | |
$errConnections[0].Properties |
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
Function DeleteUser | |
{ | |
param( | |
[String] $token, | |
[String] $upn | |
) | |
$headers = @{"Authorization" = "Bearer $($token)"; "Content-Type" = "application/json"} | |
$deleteUserUri = "https://graph.windows.net/<your.tenant.domain>/users/$($upn)?api-version=1.5" | |
$userDeleteResult = Invoke-WebRequest -Uri $deleteUserUri -Headers $headers -Method Delete | |
$userDeleteResult |
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
Connect-MsolService | |
# Get Service Principal to add the role to | |
$sp = Get-MsolServicePrincipal -ServicePrincipalName "<URI_OF_YOUR_AZURE_AD_APP>" | |
# Get role object ID | |
# Alternatively, you can list all the roles (in order to get a different role name) using just `Get-MsolRole` | |
$roleId = (Get-MsolRole -RoleName "Company Administrators").ObjectId | |
# Add role to service principal |
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
Function UpdateUser | |
{ | |
param( | |
[String] $token | |
) | |
$headers = @{"Authorization" = "Bearer $($token)"; "Content-Type" = "application/json"} | |
$updateUserUri = "https://graph.windows.net/dayzure.onmicrosoft.com/users/maxm@dayzure.onmicrosoft.com?api-version=1.5" | |
$updateBody = @" | |
{ | |
"department":"Super Devs" |
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
Function GetToken | |
{ | |
param( | |
[String] $authority = "https://login.microsoftonline.com/<your_tenant>/oauth2/token", | |
[String] $clientId = "<client_id>", | |
[String] $clientSecret = "<client_secret>", | |
[String] $resourceId = "https%3a%2f%2fgraph.windows.net" | |
) | |
$body = "grant_type=client_credentials&resource=$($resourceId)&client_id=$($clientId)&client_secret=$($clientSecret)" |
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
Function GetToken | |
{ | |
param( | |
[String] $authority = "https://login.microsoftonline.com/lab09.onmicrosoft.com/oauth2/token", | |
[String] $clientId = "<your_client_id_here>", | |
[String] $clientSecret = "<client_secret>", | |
[String] $resourceId = "https%3a%2f%2fgraph.windows.net" | |
) | |
$body = "grant_type=client_credentials&resource=$($resourceId)&client_id=$($clientId)&client_secret=$($clientSecret)" |
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
Function GetToken | |
{ | |
param( | |
[String] $authority = "https://login.microsoftonline.com/lab09.onmicrosoft.com/oauth2/token", | |
[String] $clientId = "0bc190c9-e84e-4df3-9ef8-xyxyxyxyxyxyxyx", | |
[String] $clientSecret = "RJ30qUKSyRMhLICJRsqxxxCX01yyUMeF8xxyoo9xL7ltY=", | |
[String] $resourceId = "https%3a%2f%2fgraph.windows.net" | |
) | |
$body = "grant_type=client_credentials&resource=$($resourceId)&client_id=$($clientId)&client_secret=$($clientSecret)" |
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
Adding Service Principal (Application) to greater security groups | |
https://support.microsoft.com/en-us/kb/3004133 |