Thursday, 20 July 2017

How to create Nested Virtualization in Azure.


Azure Nested Virtualization


Azure announced nested virtualization with Dv3 & Ev3 series, on July 13, 2017. And will continue to expand support to more VM sizes in the coming months.















Prerequisites
  • A Hyper-V host running Windows Server 2016 or Windows 10 Anniversary Update.
  • A Hyper-V VM running Windows Server 2016 or Windows 10 Anniversary Update.
  • A Hyper-V VM with configuration version 8.0 or greater.
  • An Intel processor with VT-x and EPT technology.
 Login to you Azure Subscription, and create virtual machine as follows.
Select Windows server 2016,  


































Please select proper location because as of now Nested Virtualization supports only certain locations. For more information on locations support NV please Click














Select the VM Size, As of now Azure Nested Virtualization supports only DV3 & EV3 series. So please select your VM size carefully. Here I am selecting D8S_V3. and other parameters as usual. And it will take approx. 4 to 5 min to provision.














Once VM provision, Login to VM and Install Hyper-V Service. 

















































Once the installation done, your host machine will restart. After restart login back to VM and open Hyper-V Manager.





Network for Guest VM.

Open Hyper-V Manager and Click on Virtual switch manager and create one Internal Network.































Click on newly created network and assign IP address. My case I gave 192.168.0.1
 





















Now Download windows 10 and install.
Meanwhile you need to install DHCP services to your host VM and configure the same IP range which you already assigned to your host VM additional Virtual internal network.
So that it will release IP to your Guest VM, if this doesn’t work please run below script on PowerShell.

New-NetNat -Name MyNATnetwork -InternalIPInterfaceAddressPrefix 192.168.0.0/24



                                                             Enjoy your Nested VM😊

Note: Please comment if anything not working or you face any issues...
 
 
 





Friday, 23 December 2016

Create User And Assign Licenses In O365 Using PowerShell Script

Create User And Assign Licenses In O365 Using PowerShell Script

Pre-Requisites:
      1)      Office 365 account (work or personal account).

      2)      There are 2 binaries that you need to install: -
·         Microsoft Online Services Sign-In Assistant for IT Professionals RTW

·         Azure Active Directory Module for Windows PowerShell

Both of these need to be the 64bit version to work together.

Connect to O365

1.      On your local computer, open Windows PowerShell as an administrator (use Run as administrator).

 Run this command, and enter your Office 365 work or school account credentials.
$Credential = Get-Credential

               In the Windows PowerShell Credential Request dialog box, type your Office                                    365 username and password, and then click OK.


2.    To view login credentials, run the following command –
       $credential

  The command returns data similar to this:

UserName                                                   Password
--------                                                   --------
yourname@companyname.onmicrosoft.com System.Security.SecureString
 
 
3.    Import MSOnline module to allow connectivity to Microsoft Office 365 
Import-Module MsOnline
 
4.    Establish a PS session with Microsoft Office 365
 
Connect-MsolService -Credential $credential
 
5.      Run the following command: -

$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $credential -Authentication Basic AllowRedirection

$importresults = Import-PSSession $s


6.      To view summary information about your current licensing plans and the available licenses for each plan, run the following command:

Get-MsolAccountSku
           
   The command returns data similar to this:

AccountSkuId             ActiveUnits WarningUnits ConsumedUnits
------------             ----------- ------------ -------------
companyname:ENTERPRISEPACK 0           25           6           
companyname:CRMSTANDARD    0           25           1           


        The results contain the following information:

·        AccountSkuId
Show the available licensing plans for your organization by using the syntax <CompanyName>:<LicensingPlan>. <CompanyName> is the value that you provided when you enrolled in Office 365, and is unique for your organization. The <LicensingPlan> value is the same for everyone. For example, in the value litwareinc:ENTERPRISEPACK, the company name is litwareinc, and the licensing plan name ENTERPRISEPACK, which is the system name for Office 365 Enterprise E3.

·        ActiveUnits
Number of licenses that you've purchases for a specific licensing plan.

·        WarningUnits
Number of licenses in a licensing plan that you haven't renewed, and that will expire after the 30-day grace period.

·        ConsumedUnits
Number of licenses that you've assigned to users from a specific licensing plan.


7.      To view the list of all user accounts and their licensing status, run the following command:

Get-MsolUser -All
Or
Get-MsolUser

                In turn, Get-MsolUser returns data similar to this:
           
UserPrincipalName                            DisplayName      isLicensed
-----------------                              -----------      ----------
pallavias@companyname.onmicrosoft.com          Pallavi AS       True     
zia@companyname.onmicrosoft.com                Zia Siddiqui     True     
jyotishah@companyname.onmicrosoft.com          Jyoti Shah       True     
sonaliwetal@companyname.onmicrosoft.com        Sonali Wetal     True     
manjarinagle@companyname.onmicrosoft.com       Manjari Nagle    True     
parikshitanagle123@companyname.onmicrosoft.com parikshita nagle True     



To view the list of all unlicensed user accounts in your organization, run the following command:

Get-MsolUser -All -UnlicensedUsersOnly

This command returns information about any users who are not currently licensed for Office 365:

               UserPrincipalName           DisplayName                     isLicensed
-----------------           -----------                     ----------
            BelindaN@litwareinc.com     Belinda Newman                  False

To view the list of all licensed user accounts in your organization, run the following command:

Get-MsolUser -All | where {$_.isLicensed -eq $true}

The command returns data similar to this:

UserPrincipalName                            DisplayName      isLicensed
-----------------                            -----------      ----------
pallavias@companyname.onmicrosoft.com          Pallavi AS       True      
zia@companyname.onmicrosoft.com                Zia Siddiqui     True     
jyotishah@companyname.onmicrosoft.com          Jyoti Shah       True     
sonaliwetal@companyname.onmicrosoft.com        Sonali Wetal     True     
manjarinagle@companyname.onmicrosoft.com       Manjari Nagle    True     
parikshitanagle123@companyname.onmicrosoft.com parikshita nagle True     



8.      To create an individual account, use the following syntax :

New-MsolUser -DisplayName <DisplayName> -FirstName <FirstName> -LastName <LastName> -UserPrincipalName <Account> -UsageLocation <CountryCode> -LicenseAssignment <AccountSkuID> [-Password <Password>]
This example creates an account for the United States user named User 1, and assigns a license from the companyname:ENTERPRISEPACK (Office 365 Enterprise E3) licensing plan :-

New-MsolUser -DisplayName "User 1" -FirstName User -LastName 1 -UserPrincipalName user1@ companyname.onmicrosoft.com -UsageLocation US -LicenseAssignment companyname:ENTERPRISEPACK

In turn, this returns data similar to this:

Password UserPrincipalName               DisplayName isLicensed
-------- -----------------               ----------- ----------
Cunu9586 user1@companyname.onmicrosoft.com  user1    True     


To verify that the user has been assigned a license, run a command like the following:

Get-MsolUser -UserPrincipalName
"user1@yourcompany.onmicrosoft.com"

If everything worked as expected, you should see that Varun’s isLicensed property is now set to True:

UserPrincipalName                       DisplayName isLicensed
-----------------                       ----------- ----------
User1@companyname.onmicrosoft.com       User 1        True  


            Now, set password for the user account. Run the following command: -

    Set-MsolUserPassword -UserPrincipalName                                     user1@companyname.onmicrosoft.com -NewPassword                   YourPassword -ForceChangePassword $False
or
             Set-MsolUserPassword -UserPrincipalName                                              yourname@companyname.onmicrosoft.com -NewPassword                    YourPassword -ForceChangePassword $True

9.      This example shows the services that user user1@companyname.onmicrosoft.com has access to. This shows the services that are associated with all licenses that are assigned to his account.
 
(Get-MsolUser -UserPrincipalName 
user1@companyname.onmicrosoft.com).Licenses.ServiceStatus

In turn, this returns data similar to this:
 
ServicePlan           ProvisioningStatus
-----------           ------------------
FLOW_O365_P2          Success          
POWERAPPS_O365_P2     Success          
TEAMS1                Success          
PROJECTWORKMANAGEMENT Success          
SWAY                  Success           
INTUNE_O365           PendingActivation
YAMMER_ENTERPRISE     Success          
RMS_S_ENTERPRISE      Success          
OFFICESUBSCRIPTION    Success          
MCOSTANDARD           Success          
SHAREPOINTWAC         Success          
SHAREPOINTENTERPRISE  Success          
EXCHANGE_S_ENTERPRISE Success     


Testing

Login to the O365 portal (portal.office.com) using the credentials: -

Password: **********

Perform few operations like: -

·         Sending email
·         Go to admin portal
·         Check users
·         Check newly added users
·         Check licenses, etc.


Script

$credential = Get-Credential

Import-Module MsOnline

$credential

Connect-MsolService -Credential $credential

Get-MsolAccountSku

$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $credential
-Authentication Basic -AllowRedirection

$importresults = Import-PSSession $s

Get-MsolUser

(Get-MsolUser -UserPrincipalName youname@companyname.onmicrosoft.com).Licenses.ServiceStatus

Get-MsolUser | where {$_.isLicensed -eq $true}

Get-MsolUser -All -UnlicensedUsersOnly

New-MsolUser -DisplayName "Firstname Lastname" -FirstName Yourfirstname -LastName Yourlastname -UserPrincipalName youname@companyname.onmicrosoft.com
-UsageLocation US -LicenseAssignment companyname:O365_BUSINESS_PREMIUM

Set-MsolUserPassword -UserPrincipalName youname@companyname.onmicrosoft.com -NewPassword YourPassword -ForceChangePassword $False




Get SSL Certificate Expiry Notification on Mail.

 There are multiple ways to get SSL Certification expiry details/alert. We all know if our SSL certificate get expire, how critical situatio...