.. _ms-test-tenant-connection-ms-teams:

Test Your Tenant Connection
----------------------------

You can test your ability to connect to Azure Active Directory by performing the following procedure from a 
non-privileged PowerShell session.


Configure Your Test Session for Outbound Internet Proxy
........................................................

If your PowerShell Proxy server is behind an outbound Internet proxy that requires authentication, issue 
the following commands from your PowerShell session.

When prompted, enter your outbound proxy credentials.

::

   $w = New-Object System.Net.WebClient
   $w.Proxy.Credentials = (Get-Credential) 


.. note::
   The credentials you enter above persist only for the duration of this PowerShell session. When you exit 
   the PowerShell session the credentials are deleted.

Keep this window open for the remainder of the procedures in this section.


Test Connection to Azure Active Directory
..........................................

Connect to Azure Active Directory and do a test query by issuing the following commands. If your PowerShell 
Proxy is behind an outbound Internet proxy that requires authentication, first refer to the steps at the 
beginning of this section.

When prompted, enter your Azure AD service account credentials.

::
    
    Connect-MsolService -Credential (Get-Credential) 
    Get-MsolUser -MaxResults 1

The above commands should successfully connect to the tenant and retrieve one random user.


Test Connection to Microsoft Teams
...................................

Connect to Microsoft Teams and do a test query by issuing the following commands. If your PowerShell Proxy 
is behind an outbound Internet proxy that requires authentication, first refer to the steps at the beginning 
of this section.

When prompted, enter your Teams service account credentials.

::

    Connect-MicrosoftTeams -Credential (Get-Credential)
    Import-PSSession $s -AllowClobber
    Get-CsOnlineUser -ResultSize 1 | Select DisplayName
  
The above commands should successfully connect to the tenant and retrieve one random user.