Persisting Azure Login across PowerShell Sessions

Now you can persist your azure login sessions across multiple sessions and even after reboots. Beginning with Azure PowerShell v4.4.0, you can enable the automatic saving and reuse of Azure Contexts whenever you open a new PowerShell session.

Run the below command in your powershell session and it will enable the autosave of the context.
Enable-AzureRmContextAutosave

Reference: Azure Context

Disable Access Requests – SharePoint 2013

If you migrate from MOSS 2007 or SharePoint 2010 to SharePoint 2013, the access requests are enabled by default and are set to the email for the primary site collection administrator.

It can be a good thing if you want your end users to request access as needed but if you have more than 300 site collections which are centrally managed by a team of administrators managing thousands of users. It soon becomes a nightmare.

To avoid such scenarios, you can disable the Access Requests by a quick powershell script on the web application.

Below script sets the Access Request Email as none which inherently sets the “RequestAccessEnabled” to false.

There is no direct way to set this flag as it is exposed as a read only property.

$spsites = get-spsite -WebApplication  -Limit All
foreach($spsite in $spsites)
{
    foreach($SPweb in $spsite.AllWebs)
    {
        # if a site inherits permissions, then the Access request mail setting also will be inherited
        if (!$SPweb.HasUniquePerm)
        {
            Write-Host "Inheriting from Parent site";
        }   
        elseif($SPweb.RequestAccessEnabled)
        {
            $SPweb.RequestAccessEmail = "";
	    $SPweb.Update();
        }
    }
}