Microsoft Azure – Virtual Labs/Demo

Demo 4.1 Provision Microsoft Azure Virtual Machines By Using the Management Portal

Demo 6.2 Configure Multi-Factor Authentication in Microsoft Azure Active Directory

Demo 6.1 Getting Started with Microsoft Azure Active Directory

Demo 5 Monitor Virtual Machines By Using the Management Portal

Demo 4.5d Manage Microsoft Azure Virtual Machine Checkpoints By Using Windows PowerShell – Setting up Static IP to Azure VM

Demo 4.5c Export and Import Microsoft Azure Virtual Machines By Using Windows PowerShell

Demo 4.5a Provision Microsoft Azure Virtual Machines By Using Windows PowerShell

Demo 4.5b Configure Microsoft Azure Virtual Machines By Using Windows PowerShell


Find some other fancy demos below

Basic Office365 Users and Group Management with PowerShell

The script comments will be enought to explain each step.  Its kind of Hello World scripts.  But may help someone for copy paste πŸ™‚

# First Get the Stuff you need. You do not need a server.  Windows 7, Windows 8 is good enought πŸ™‚ But 64Bit.
#Connecting with Office 365
$CRed = Get-Credential
Connect-MsolService -Credential $CRed

#Listing Users
Get-MsolUser | Select UserPrincipalName, DisplayName, ObjectId

#Listing New User
New-MsolUser -UserPrincipalName "" -DisplayName "FirstName LastName" -FirstName "FirstName" -LastName "LastName"

New-MsolUser -UserPrincipalName "" -DisplayName "FirstName LastName" -FirstName "FirstName" -LastName "LastName"

#Sending to REcyle Bin
Remove-MsolUser -UserPrincipalName ""

#Restoring the User from Recyle Bin
Restore-MsolUser -UserPrincipalName ""

#Sending to Permanently Removing
Remove-MsolUser -UserPrincipalName "" -RemoveFromRecycleBin -Force

#Findig User
Get-MsolUser | ? DisplayName -eq "FirstName LastName" 
Get-MsolUser | ? UserPrincipalName -eq ""

#Getting and chaning User information.  Assigning Usage Location to assing Licneses
$TestUser = Get-MsolUser | ? UserPrincipalName -EQ ""
Set-MsolUser -ObjectId $TestUser.ObjectId -UsageLocation "US"
Set-MsolUser -ObjectId $TestUser.ObjectId -DisplayName "Changed First, LastName" -FirstName "NewFirstName" -LastName "NewLastName"

#Display Licenses
Get-MsolUser | ft displayname, Licenses

#List the Office 365 Subscription or Sku

#Set the License for User (This will assign all the Available Licenses)
Set-MsolUserLicense -ObjectId $TestUser.ObjectId -AddLicenses (Get-MsolAccountSku).AccountSkuId
Set-MsolUserLicense -UserPrincipalName $TestUser.UserPrincipalName -AddLicenses (Get-MsolAccountSku).AccountSkuId

#DisplayUser Information
Get-MsolUser | ft displayname, Licenses

#List All Plans
Get-MsolAccountSku | Where-Object {$_.SkuPartNumber -eq "ENTERPRISEPACK"} | ForEach-Object {$_.ServiceStatus}

#Making a Sub Option object for Selective values
$Options = New-MsolLicenseOptions -AccountSkuId (Get-MsolAccountSku).AccountSkuId -DisabledPlans SHAREPOINTWAC, EXCHANGE_S_ENTERPRISE

#Assigning it user object 
Set-MsolUserLicense -UserPrincipalName $TestUser.UserPrincipalName -LicenseOptions $Options -Verbose

#Creating a New Office 365 Group 
$Group = New-MsolGroup -DisplayName "ATM" -Description "ATM Users"
#Getting the Group
$Group = Get-MsolGroup | ? DisplayName -EQ "ATM"
#Adding Member to Group
Add-MsolGroupMember -GroupObjectId $Group.ObjectId -GroupMemberObjectId $TestUser.ObjectId
Get-MsolGroupMember -GroupObjectId $Group.objectId

#Reading Properties of Users in a Group
Get-MsolGroupMember -GroupObjectId $Group.ObjectId -All | Select ObjectId, DisplayName, EmailAddress

#REmvoing Group Peramentnly - not Recylebin here πŸ™‚
Remove-MsolGroup -ObjectId $Group.ObjectId

#Sampe CSV
#Blank CSV

#Build Import Users from CSV (Please Remove Formatting if it does not work :))
Import-Csv -Path c:\Users.csv | ForEach-Object 
        New-MsolUser -UserPrincipalName $_."UPN"   -AlternateEmailAddresses $_."AltEmail" 
                    -FirstName $_."FirstName"     -LastName $_."LastName" 
                    -DisplayName $_."DisplayName" -BlockCredential $False 
                    -ForceChangePassword $False   -LicenseAssignment $_."LicenseAssignment" 
                    -Password $_."Password"       -PasswordNeverExpires $True 
                    -Title $_."Title"             -Department $_."Department" 
                    -Office $_."Office"           -PhoneNumber $_."PhoneNumber" 
                    -MobilePhone $_."MobilePhone" -Fax $_."Fax" 
                    -StreetAddress $_."StreetAddress" -City $_."City" 
                    -State $_."State"                 -PostalCode $_."PostalCode" 
                    -Country $_."Country"             -UsageLocation $_."UsageLocation" 

Powershell – current folder and file

While working with PowerShell some times if is required to access resources like XML and csv files from local folder where the PS1 file is placed.  PowerShell 3.0 has made it easy for us.  Use the script below to get current folder, file and execution path

$thisfolderIncludingFileName = Split-Path -parent $MyInvocation.MyCommand.Definition
$currentScriptName = $MyInvocation.MyCommand.Name

$currentExecutionPath = $thisfolderIncludingFileName.Replace($currentScriptName, "");

Write-Host "Current Folder with FileName : $thisfolder"
Write-Host "Current File Name : $currentScriptName"
Write-Host "Current Exeuction Path $currentExecutionPath"


Note: I have find out that you must save your script file before you can test these calls and you can not get this path when you press F8 to execute any script line by line.

Enabling internet proxy using powershell

If you are feeling lazy and not intersted in setting up Internet proxy on your server from UI then use the script below to enable and disable.  Nothing special but works.

To Enable the proxy

$ProxyServer = "" $ProxyPort = "8080" $Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $Proxy = $ProxyServer + ":" + $ProxyPort # Enable an explicit proxy Set-ItemProperty -Path $path -Name ProxyEnable -Value 1 #Enable the explicit proxy Set-ItemProperty -Path $path -Name ProxyServer -Value $Proxy #Configure the server settings

To Disable the Proxy

# Disable an explicit proxy
Set-ItemProperty -Path $path -Name ProxyEnable -Value 0 #Disable the explicit proxy