Last active
January 5, 2017 04:13
-
-
Save darrenjrobinson/408ba8e6354657c0effe2e106f2a4241 to your computer and use it in GitHub Desktop.
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 with your Azure Admin Account | |
Add-AzureRmAccount | |
# Create an App that will be used by the Azure Automation Function App | |
$app = New-AzureRmADApplication -DisplayName "Azure Automation Functions" -HomePage "https://www.mydomain.com/AAFunctions" -IdentifierUris "https://www.mydomain.com/AAFunctions" -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 | |
$tenant | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment