I have done hundreds of events and there are always obstacles to onboarding the attendees/students. I decided to create a succinct help document. I hope this helps
PowerShell
Everything after a “#” pound sign is a not and can be ignored; no need to paste that into the PowerShell window.
Run PowerShell as an Administrator
Allows you to run administrative commands [sometimes needed to install modules]
Start – Type PowerShell – Right-click, run as administrator # see also
Install Azure RM Modules
Give you the ability to run Azure commands in PowerShell. # see also #Prior to Windows 10, you will need to download and install Azure PowerShell; from the Azure downloads page Command Line Tools (Windows Install) .
Install-module AzureRM # Add AzureRM
Install-module AzureRM.storage # Add Azure Storage
Get-Module -ListAvailable AzureRM* # Show available AzureRM modules
Authenticate to Azure
Connect to Azure # see also
Login-AzureRmAccount
Change Default Subscription
# see also
Get-AzureRMSubscription # List available subscriptions
Select-AzureRmSubscription –SubscriptionID “SubscriptonID” # Copy SubscriptionID of the subscription from the SubscriptionList
Set-AzureRmContext -SubscriptionID “SubscriptionID” # Copy SubscriptionID of the subscription from the SubscriptionList
Change Default Subscription via GUI (popup box)
# Select Subscription via popup list # see also
#Pop-up Box with list of subscriptions; return selected subscription
$MySubscription = (Get-AzureRmSubscription | Out-GridView -Title “Select an Azure Subscription …” -PassThru)
$subscriptionId = $mySubscription.SubscriptionId # Set a variable for SubscriptionID
$SubscriptionName = $mySubscription.SubscriptionName #Set a variable for SubscriptionName
Select-AzureRmSubscription -SubscriptionId $SubscriptionId # Set Default Subscription
Set-AzureRmContext -SubscriptionID $subscriptionId # Set Default Context
Write-Host “Subscription: $SubscriptionName [ID: $subscriptionId ]” -ForegroundColor Green # Show the new default subscription
get-AzureRMContext #Display Current Subscription
Give Users Access to a Subscription
# Assumptions: Login to Azure; Default Subscription set; You are the owner of a subscription
Coming Soon…. NOT FINISHED OR TESTED…. Need to add more documentation
#Search for an Azure Group By Name
#Get-AzureRmADgroup -SearchString “group name” # Optional: if needed
#Get-AzureRmADServicePrincipal -SearchString “service name” # Optional: if needed
Get-AzureRmRoleDefinition |format-table ID, Name, Description # List existing Role Definitions
#Get the OjectID of the user by name
$User=Get-AzureRmAdUser -SearchString “Dan Stolts” # Get ObjectID for a particular user (by name)
$User # Display list of users
Get-AzureRmAdUser -UserPrincipalName “email@company.com”
$User=Get-AzureRmAdUser -UserPrincipalName “Dan Stolts” # Get ObjectID for a particular user (by name)
$User.UserPrincipalName
Get-AzureRmSubscription # List avaialble subscriptions
# Set the permission for the user
# Syntax: New-AzureRmRoleAssignment -ObjectId <application id> -RoleDefinitionName <role name> -Scope <subscription id>
# Example:New-AzureRmRoleAssignment -ObjectId “81f4a203-9950-4f4d-9a5d-12e3b45d67f8” -RoleDefinitionName “Owner” -Scope “1942a221-7d86-4e10-9e4b-a5bc2688651d”
New-AzureRmRoleAssignment -ObjectId “UserID” -RoleDefinitionName “Role” -Scope “SubscriptionID”
New-AzureRmRoleAssignment -ObjectId <application id> -RoleDefinitionName <role name> -Scope <subscription id>