Updated - Office 365 and Azure PowerShell Connection Script - Simplified with variables

Got some issues. Most of the connection were made fine when executing the script. I do have SharePoint Online, but I am getting an error when connecting.

Same thing with Skype for Business.

Connect-SPOService : Could not connect to SharePoint Online.
At C:\ps\Connect-Office365.ps1:86 char:1
+ Connect-SPOService -Url "https://$($Tenant)-admin.sharepoint.com" -Cr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-SPOService], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Online.SharePoint.PowerShell.ConnectSPOServic
   e


Start WinRM Service
WinRM service is not started currently. Running this command will start the WinRM service.

Do you want to continue?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y
New-PSSession : [admin1a.online.lync.com] Processing data from remote server admin1a.online.lync.com failed with the
following error message: One or more errors occurred. For more information, see the about_Remote_Troubleshooting Help
topic.
At C:\Program Files\Common Files\Skype for Business
Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:147 char:16
+ ...  $session = New-PSSession -ConnectionUri $ConnectionUri.Uri -Credenti ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : IncorrectProtocolVersion,PSSessionOpenFailed
PS C:\ps>
/r/sysadmin Thread Parent