Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Login with your Azure Admin Account
# Create an App that will be used by the Azure Automation Function App
$app = New-AzureRmADApplication -DisplayName "Azure Automation Functions" -HomePage "" -IdentifierUris "" -Password "thisisntmypassword!"
# Copy the AppID to the clipboard
$applicationID = $app.ApplicationId.Guid | clip
# Create the App Service Principal
New-AzureRmADServicePrincipal -ApplicationId $app.ApplicationId
# wait for replication
Start-Sleep 15
# Assign Role DevTest Labs User which provides the ability to view everything and connect, start, restart, and shutdown virtual machines
New-AzureRmRoleAssignment -RoleDefinitionName 'DevTest Labs User' -ServicePrincipalName $app.ApplicationId
# Get the TenantID (I only have one)
$tenant = (Get-AzureRmSubscription).TenantId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.