14 March 2018

Enable MFA for all Office365 users at once with PowerShell

Now that Multi Factor Authentication is widely supported through all the different PowerShell modules within Office365 and Azure it's a good idea and a best practice to enable MFA for all accounts. Especially admin accounts.

So how do we do this?
After connecting to the MSOnline service with PowerShell run:

$auth = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement            
$auth.RelyingParty = "*"            
$auth.State = "Enabled"            
$auth.RememberDevicesNotIssuedBefore = (Get-Date)            
Get-MsolUser –All | Foreach{ Set-MsolUser -UserPrincipalName $_.UserPrincipalName -StrongAuthenticationRequirements $auth}

All users are now "enabled" for MFA.
This should give you a lot of extra brownie points on your secure score rating :-)

12 March 2018

How to restore a private key in IIS 7.0 or IIS 8.0

The following instructions apply to Windows Server 2008 (IIS 7.0) & Windows Server 2012 (IIS 8.0). Perform the following steps to restore the private key.

Import SSL certificate into the Personal > Certificates folder
Create a Certificates snap-in in a MMC console, refer to solution SO9999.
From the top left-hand pane, expand the Certificates tree, expand the Personal folder
Right-click the Certificates sub folder and select All Tasks > Import
The Certificate Import Wizard opens. Click Next
Click Browse and then navigate to the SSL certificate file.
Click Open > Next
Ensure "Place all certificates in the following store" is selected, ensure that "Personal" is listed for the certificate store.
Click Next > Finish

Import the Intermediate Certificate into the Intermediate Certification Authorities > Certificates folder
Download the correct Intermediate CA certificate, refer to article INFO1421.
From the left pane, expand the Intermediate Certification Authorities folder
Right-click on the Certificates sub folder
Select All Tasks > Import - A Certificate Import Wizard will open.
Click Next
Click Browse and then navigate to the Intermediate CA Certificate file
Click Next
Select Place all certificates in the following store: Intermediate Certification Authorities
Click Next
Click Finish 

Restore Private Key
With the MMC console still open, select the Certificates folder inside the Personal folder in the left-hand pane.
Double-click the newly imported SSL certificate in the right-hand pane, then select the Details tab.
Scroll down and select the Thumbprint field, then select and copy the entire thumbprint (in the bottom box) to the clipboard.
Open a command prompt, then enter the following command:
certutil -repairstore my "<thumbprint>"
certutil -repairstore my "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f"
If successful, the response will be "CertUtil: -repairstore command completed successfully"
Assign SSL certificate in IIS
Go to > Start > Administrative Tools > Internet Information Services (IIS) Manager.
From the Connections pane on the left, expand the local server, expand the Sites folder and select the web site to be secured with SSL.
From the Actions pane on the right, select the Bindings option under Edit Site.
In the Site Bindings window, select an existing https binding and click Edit. If there are no existing https bindings, click Add.
Ensure the type is set to 'https', then select the new SSL certificate from the drop down menu.
Click the View button to confirm details of the certificate.
Click OK > Close