Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
--- | ||
title: 'Tutorial: Azure Active Directory integration with InTime | Microsoft Docs' | ||
description: Learn how to configure single sign-on between Azure Active Directory and InTime. | ||
services: active-directory | ||
documentationCenter: na | ||
author: jeevansd | ||
manager: femila | ||
ms.reviewer: joflore | ||
|
||
ms.assetid: d4e2c6e1-ae5d-4d2c-8ffc-1b24534d376a | ||
ms.service: active-directory | ||
ms.workload: identity | ||
ms.tgt_pltfrm: na | ||
ms.devlang: na | ||
ms.topic: article | ||
ms.date: 08/05/2017 | ||
ms.author: jeedes | ||
|
||
--- | ||
# Tutorial: Azure Active Directory integration with InTime | ||
|
||
In this tutorial, you learn how to integrate InTime with Azure Active Directory (Azure AD). | ||
|
||
Integrating InTime with Azure AD provides you with the following benefits: | ||
|
||
- You can control in Azure AD who has access to InTime. | ||
- You can enable your users to automatically get signed-on to InTime (Single Sign-On) with their Azure AD accounts. | ||
- You can manage your accounts in one central location - the Azure portal. | ||
|
||
If you want to know more details about SaaS app integration with Azure AD, see [what is application access and single sign-on with Azure Active Directory](active-directory-appssoaccess-whatis.md). | ||
|
||
## Prerequisites | ||
|
||
To configure Azure AD integration with InTime, you need the following items: | ||
|
||
- An Azure AD subscription | ||
- A InTime single sign-on enabled subscription | ||
|
||
> [!NOTE] | ||
> To test the steps in this tutorial, we do not recommend using a production environment. | ||
To test the steps in this tutorial, you should follow these recommendations: | ||
|
||
- Do not use your production environment, unless it is necessary. | ||
- If you don't have an Azure AD trial environment, you can [get a one-month trial](https://azure.microsoft.com/pricing/free-trial/). | ||
|
||
## Scenario description | ||
In this tutorial, you test Azure AD single sign-on in a test environment. | ||
The scenario outlined in this tutorial consists of two main building blocks: | ||
|
||
1. Adding InTime from the gallery | ||
2. Configuring and testing Azure AD single sign-on | ||
|
||
## Adding InTime from the gallery | ||
To configure the integration of InTime into Azure AD, you need to add InTime from the gallery to your list of managed SaaS apps. | ||
|
||
**To add InTime from the gallery, perform the following steps:** | ||
|
||
1. In the **[Azure portal](https://portal.azure.com)**, on the left navigation panel, click **Azure Active Directory** icon. | ||
|
||
![The Azure Active Directory button][1] | ||
|
||
2. Navigate to **Enterprise applications**. Then go to **All applications**. | ||
|
||
![The Enterprise applications blade][2] | ||
|
||
3. To add new application, click **New application** button on the top of dialog. | ||
|
||
![The New application button][3] | ||
|
||
4. In the search box, type **InTime**, select **InTime** from result panel then click **Add** button to add the application. | ||
|
||
![InTime in the results list](./media/active-directory-saas-intime-tutorial/tutorial_intime_addfromgallery.png) | ||
|
||
## Configure and test Azure AD single sign-on | ||
|
||
In this section, you configure and test Azure AD single sign-on with InTime based on a test user called "Britta Simon". | ||
|
||
For single sign-on to work, Azure AD needs to know what the counterpart user in InTime is to a user in Azure AD. In other words, a link relationship between an Azure AD user and the related user in InTime needs to be established. | ||
|
||
In InTime, assign the value of the **user name** in Azure AD as the value of the **Username** to establish the link relationship. | ||
|
||
To configure and test Azure AD single sign-on with InTime, you need to complete the following building blocks: | ||
|
||
1. **[Configure Azure AD Single Sign-On](#configure-azure-ad-single-sign-on)** - to enable your users to use this feature. | ||
2. **[Create an Azure AD test user](#create-an-azure-ad-test-user)** - to test Azure AD single sign-on with Britta Simon. | ||
3. **[Create a InTime test user](#create-a-intime-test-user)** - to have a counterpart of Britta Simon in InTime that is linked to the Azure AD representation of user. | ||
4. **[Assign the Azure AD test user](#assign-the-azure-ad-test-user)** - to enable Britta Simon to use Azure AD single sign-on. | ||
5. **[Test single sign-on](#test-single-sign-on)** - to verify whether the configuration works. | ||
|
||
### Configure Azure AD single sign-on | ||
|
||
In this section, you enable Azure AD single sign-on in the Azure portal and configure single sign-on in your InTime application. | ||
|
||
**To configure Azure AD single sign-on with InTime, perform the following steps:** | ||
|
||
1. In the Azure portal, on the **InTime** application integration page, click **Single sign-on**. | ||
|
||
![Configure single sign-on link][4] | ||
|
||
2. On the **Single sign-on** dialog, select **Mode** as **SAML-based Sign-on** to enable single sign-on. | ||
|
||
![Single sign-on dialog box](./media/active-directory-saas-intime-tutorial/tutorial_intime_samlbase.png) | ||
|
||
3. On the **InTime Domain and URLs** section, perform the following steps: | ||
|
||
![InTime Domain and URLs single sign-on information](./media/active-directory-saas-intime-tutorial/tutorial_intime_url.png) | ||
|
||
a. In the **Sign-on URL** textbox, type the URL: `https://intime6.intimesoft.com/mytime/login/login.xhtml` | ||
|
||
b. In the **Identifier** textbox, type the URL: `https://auth.intimesoft.com/auth/realms/master` | ||
|
||
4. On the **SAML Signing Certificate** section, click **Metadata XML** and then save the metadata file on your computer. | ||
|
||
![The Certificate download link](./media/active-directory-saas-intime-tutorial/tutorial_intime_certificate.png) | ||
|
||
5. Click **Save** button. | ||
|
||
![Configure Single Sign-On Save button](./media/active-directory-saas-intime-tutorial/tutorial_general_400.png) | ||
|
||
6. On the **InTime Configuration** section, click **Configure InTime** to open **Configure sign-on** window. Copy the **Sign-Out URL, and SAML Single Sign-On Service URL** from the **Quick Reference section.** | ||
|
||
![InTime Configuration](./media/active-directory-saas-intime-tutorial/tutorial_intime_configure.png) | ||
|
||
7. To configure single sign-on on **InTime** side, you need to send the downloaded **Metadata XML**, **Sign-Out URL, and SAML Single Sign-On Service URL** to [InTime support team](mailto:hdollard@intimesoft.com). They set this setting to have the SAML SSO connection set properly on both sides. | ||
|
||
> [!TIP] | ||
> You can now read a concise version of these instructions inside the [Azure portal](https://portal.azure.com), while you are setting up the app! After adding this app from the **Active Directory > Enterprise Applications** section, simply click the **Single Sign-On** tab and access the embedded documentation through the **Configuration** section at the bottom. You can read more about the embedded documentation feature here: [Azure AD embedded documentation]( https://go.microsoft.com/fwlink/?linkid=845985) | ||
> | ||
### Create an Azure AD test user | ||
|
||
The objective of this section is to create a test user in the Azure portal called Britta Simon. | ||
|
||
![Create an Azure AD test user][100] | ||
|
||
**To create a test user in Azure AD, perform the following steps:** | ||
|
||
1. In the Azure portal, in the left pane, click the **Azure Active Directory** button. | ||
|
||
![The Azure Active Directory button](./media/active-directory-saas-intime-tutorial/create_aaduser_01.png) | ||
|
||
2. To display the list of users, go to **Users and groups**, and then click **All users**. | ||
|
||
![The "Users and groups" and "All users" links](./media/active-directory-saas-intime-tutorial/create_aaduser_02.png) | ||
|
||
3. To open the **User** dialog box, click **Add** at the top of the **All Users** dialog box. | ||
|
||
![The Add button](./media/active-directory-saas-intime-tutorial/create_aaduser_03.png) | ||
|
||
4. In the **User** dialog box, perform the following steps: | ||
|
||
![The User dialog box](./media/active-directory-saas-intime-tutorial/create_aaduser_04.png) | ||
|
||
a. In the **Name** box, type **BrittaSimon**. | ||
|
||
b. In the **User name** box, type the email address of user Britta Simon. | ||
|
||
c. Select the **Show Password** check box, and then write down the value that's displayed in the **Password** box. | ||
|
||
d. Click **Create**. | ||
|
||
### Create a InTime test user | ||
|
||
In this section, you create a user called Britta Simon in InTime. Work with [InTime support team](mailto:hdollard@intimesoft.com) to add the users in the InTime platform. Users must be created and activated before you use single sign-on. | ||
|
||
### Assign the Azure AD test user | ||
|
||
In this section, you enable Britta Simon to use Azure single sign-on by granting access to InTime. | ||
|
||
![Assign the user role][200] | ||
|
||
**To assign Britta Simon to InTime, perform the following steps:** | ||
|
||
1. In the Azure portal, open the applications view, and then navigate to the directory view and go to **Enterprise applications** then click **All applications**. | ||
|
||
![Assign User][201] | ||
|
||
2. In the applications list, select **InTime**. | ||
|
||
![The InTime link in the Applications list](./media/active-directory-saas-intime-tutorial/tutorial_intime_app.png) | ||
|
||
3. In the menu on the left, click **Users and groups**. | ||
|
||
![The "Users and groups" link][202] | ||
|
||
4. Click **Add** button. Then select **Users and groups** on **Add Assignment** dialog. | ||
|
||
![The Add Assignment pane][203] | ||
|
||
5. On **Users and groups** dialog, select **Britta Simon** in the Users list. | ||
|
||
6. Click **Select** button on **Users and groups** dialog. | ||
|
||
7. Click **Assign** button on **Add Assignment** dialog. | ||
|
||
### Test single sign-on | ||
|
||
In this section, you test your Azure AD single sign-on configuration using the Access Panel. | ||
|
||
When you click the InTime tile in the Access Panel, you should get the login page of your InTime application. Click the **Login** button, then a series of IdPs will be displayed on a list of buttons. click **IDP name** given by [InTime support team](mailto:hdollard@intimesoft.com) to login into your InTime application. For more information about the Access Panel, see [Introduction to the Access Panel](active-directory-saas-access-panel-introduction.md). | ||
|
||
## Additional resources | ||
|
||
* [List of Tutorials on How to Integrate SaaS Apps with Azure Active Directory](active-directory-saas-tutorial-list.md) | ||
* [What is application access and single sign-on with Azure Active Directory?](active-directory-appssoaccess-whatis.md) | ||
|
||
|
||
|
||
<!--Image references--> | ||
|
||
[1]: ./media/active-directory-saas-intime-tutorial/tutorial_general_01.png | ||
[2]: ./media/active-directory-saas-intime-tutorial/tutorial_general_02.png | ||
[3]: ./media/active-directory-saas-intime-tutorial/tutorial_general_03.png | ||
[4]: ./media/active-directory-saas-intime-tutorial/tutorial_general_04.png | ||
|
||
[100]: ./media/active-directory-saas-intime-tutorial/tutorial_general_100.png | ||
|
||
[200]: ./media/active-directory-saas-intime-tutorial/tutorial_general_200.png | ||
[201]: ./media/active-directory-saas-intime-tutorial/tutorial_general_201.png | ||
[202]: ./media/active-directory-saas-intime-tutorial/tutorial_general_202.png | ||
[203]: ./media/active-directory-saas-intime-tutorial/tutorial_general_203.png | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
--- | ||
title: 'Tutorial: Azure Active Directory integration with Merchlogix | Microsoft Docs' | ||
description: Learn how to configure single sign-on between Azure Active Directory and Merchlogix. | ||
services: active-directory | ||
documentationCenter: na | ||
author: jeevansd | ||
manager: femila | ||
ms.reviewer: joflore | ||
|
||
ms.assetid: a1f49bb8-6b17-433d-8f25-9d26fb390e77 | ||
ms.service: active-directory | ||
ms.workload: identity | ||
ms.tgt_pltfrm: na | ||
ms.devlang: na | ||
ms.topic: article | ||
ms.date: 08/05/2017 | ||
ms.author: jeedes | ||
|
||
--- | ||
# Tutorial: Azure Active Directory integration with Merchlogix | ||
|
||
In this tutorial, you learn how to integrate Merchlogix with Azure Active Directory (Azure AD). | ||
|
||
Integrating Merchlogix with Azure AD provides you with the following benefits: | ||
|
||
- You can control in Azure AD who has access to Merchlogix. | ||
- You can enable your users to automatically get signed-on to Merchlogix (Single Sign-On) with their Azure AD accounts. | ||
- You can manage your accounts in one central location - the Azure portal. | ||
|
||
If you want to know more details about SaaS app integration with Azure AD, see [what is application access and single sign-on with Azure Active Directory](active-directory-appssoaccess-whatis.md). | ||
|
||
## Prerequisites | ||
|
||
To configure Azure AD integration with Merchlogix, you need the following items: | ||
|
||
- An Azure AD subscription | ||
- A Merchlogix single sign-on enabled subscription | ||
|
||
> [!NOTE] | ||
> To test the steps in this tutorial, we do not recommend using a production environment. | ||
To test the steps in this tutorial, you should follow these recommendations: | ||
|
||
- Do not use your production environment, unless it is necessary. | ||
- If you don't have an Azure AD trial environment, you can [get a one-month trial](https://azure.microsoft.com/pricing/free-trial/). | ||
|
||
## Scenario description | ||
In this tutorial, you test Azure AD single sign-on in a test environment. | ||
The scenario outlined in this tutorial consists of two main building blocks: | ||
|
||
1. Adding Merchlogix from the gallery | ||
2. Configuring and testing Azure AD single sign-on | ||
|
||
## Adding Merchlogix from the gallery | ||
To configure the integration of Merchlogix into Azure AD, you need to add Merchlogix from the gallery to your list of managed SaaS apps. | ||
|
||
**To add Merchlogix from the gallery, perform the following steps:** | ||
|
||
1. In the **[Azure portal](https://portal.azure.com)**, on the left navigation panel, click **Azure Active Directory** icon. | ||
|
||
![The Azure Active Directory button][1] | ||
|
||
2. Navigate to **Enterprise applications**. Then go to **All applications**. | ||
|
||
![The Enterprise applications blade][2] | ||
|
||
3. To add new application, click **New application** button on the top of dialog. | ||
|
||
![The New application button][3] | ||
|
||
4. In the search box, type **Merchlogix**, select **Merchlogix** from result panel then click **Add** button to add the application. | ||
|
||
![Merchlogix in the results list](./media/active-directory-saas-merchlogix-tutorial/tutorial_merchlogix_addfromgallery.png) | ||
|
||
## Configure and test Azure AD single sign-on | ||
|
||
In this section, you configure and test Azure AD single sign-on with Merchlogix based on a test user called "Britta Simon". | ||
|
||
For single sign-on to work, Azure AD needs to know what the counterpart user in Merchlogix is to a user in Azure AD. In other words, a link relationship between an Azure AD user and the related user in Merchlogix needs to be established. | ||
|
||
In Merchlogix, assign the value of the **user name** in Azure AD as the value of the **Username** to establish the link relationship. | ||
|
||
To configure and test Azure AD single sign-on with Merchlogix, you need to complete the following building blocks: | ||
|
||
1. **[Configure Azure AD Single Sign-On](#configure-azure-ad-single-sign-on)** - to enable your users to use this feature. | ||
2. **[Create an Azure AD test user](#create-an-azure-ad-test-user)** - to test Azure AD single sign-on with Britta Simon. | ||
3. **[Create a Merchlogix test user](#create-a-merchlogix-test-user)** - to have a counterpart of Britta Simon in Merchlogix that is linked to the Azure AD representation of user. | ||
4. **[Assign the Azure AD test user](#assign-the-azure-ad-test-user)** - to enable Britta Simon to use Azure AD single sign-on. | ||
5. **[Test single sign-on](#test-single-sign-on)** - to verify whether the configuration works. | ||
|
||
### Configure Azure AD single sign-on | ||
|
||
In this section, you enable Azure AD single sign-on in the Azure portal and configure single sign-on in your Merchlogix application. | ||
|
||
**To configure Azure AD single sign-on with Merchlogix, perform the following steps:** | ||
|
||
1. In the Azure portal, on the **Merchlogix** application integration page, click **Single sign-on**. | ||
|
||
![Configure single sign-on link][4] | ||
|
||
2. On the **Single sign-on** dialog, select **Mode** as **SAML-based Sign-on** to enable single sign-on. | ||
|
||
![Single sign-on dialog box](./media/active-directory-saas-merchlogix-tutorial/tutorial_merchlogix_samlbase.png) | ||
|
||
3. On the **Merchlogix Domain and URLs** section, perform the following steps: | ||
|
||
![Merchlogix Domain and URLs single sign-on information](./media/active-directory-saas-merchlogix-tutorial/tutorial_merchlogix_url.png) | ||
|
||
a. In the **Sign-on URL** textbox, type a URL using the following pattern: `https://<domain>/login.php?saml=true` | ||
|
||
b. In the **Identifier** textbox, type a URL using the following pattern: `https://<domain>/simplesaml/module.php/saml/sp/metadata.php/login-windows-net` | ||
|
||
4. On the **SAML Signing Certificate** section, click **Certificate (Base64)** and then save the certificate file on your computer. | ||
|
||
![The Certificate download link](./media/active-directory-saas-merchlogix-tutorial/tutorial_merchlogix_certificate.png) | ||
|
||
5. Click **Save** button. | ||
|
||
![Configure Single Sign-On Save button](./media/active-directory-saas-merchlogix-tutorial/tutorial_general_400.png) | ||
|
||
6. On the **Merchlogix Configuration** section, click **Configure Merchlogix** to open **Configure sign-on** window. Copy the **Sign-Out URL, SAML Entity ID, and SAML Single Sign-On Service URL** from the **Quick Reference section.** | ||
|
||
![Merchlogix Configuration](./media/active-directory-saas-merchlogix-tutorial/tutorial_merchlogix_configure.png) | ||
|
||
7. To configure single sign-on on **Merchlogix** side, you need to send the downloaded **Certificate (Base64)**, **Sign-Out URL, SAML Entity ID, and SAML Single Sign-On Service URL** to [Merchlogix support team](http://www.merchlogix.com/contact/). They set this setting to have the SAML SSO connection set properly on both sides. | ||
|
||
> [!TIP] | ||
> You can now read a concise version of these instructions inside the [Azure portal](https://portal.azure.com), while you are setting up the app! After adding this app from the **Active Directory > Enterprise Applications** section, simply click the **Single Sign-On** tab and access the embedded documentation through the **Configuration** section at the bottom. You can read more about the embedded documentation feature here: [Azure AD embedded documentation]( https://go.microsoft.com/fwlink/?linkid=845985) | ||
> | ||
### Create an Azure AD test user | ||
|
||
The objective of this section is to create a test user in the Azure portal called Britta Simon. | ||
|
||
![Create an Azure AD test user][100] | ||
|
||
**To create a test user in Azure AD, perform the following steps:** | ||
|
||
1. In the Azure portal, in the left pane, click the **Azure Active Directory** button. | ||
|
||
![The Azure Active Directory button](./media/active-directory-saas-merchlogix-tutorial/create_aaduser_01.png) | ||
|
||
2. To display the list of users, go to **Users and groups**, and then click **All users**. | ||
|
||
![The "Users and groups" and "All users" links](./media/active-directory-saas-merchlogix-tutorial/create_aaduser_02.png) | ||
|
||
3. To open the **User** dialog box, click **Add** at the top of the **All Users** dialog box. | ||
|
||
![The Add button](./media/active-directory-saas-merchlogix-tutorial/create_aaduser_03.png) | ||
|
||
4. In the **User** dialog box, perform the following steps: | ||
|
||
![The User dialog box](./media/active-directory-saas-merchlogix-tutorial/create_aaduser_04.png) | ||
|
||
a. In the **Name** box, type **BrittaSimon**. | ||
|
||
b. In the **User name** box, type the email address of user Britta Simon. | ||
|
||
c. Select the **Show Password** check box, and then write down the value that's displayed in the **Password** box. | ||
|
||
d. Click **Create**. | ||
|
||
### Create a Merchlogix test user | ||
|
||
In this section, you create a user called Britta Simon in Merchlogix. Work with [Merchlogix support team](http://www.merchlogix.com/contact/) to add the users in the Merchlogix platform. | ||
|
||
### Assign the Azure AD test user | ||
|
||
In this section, you enable Britta Simon to use Azure single sign-on by granting access to Merchlogix. | ||
|
||
![Assign the user role][200] | ||
|
||
**To assign Britta Simon to Merchlogix, perform the following steps:** | ||
|
||
1. In the Azure portal, open the applications view, and then navigate to the directory view and go to **Enterprise applications** then click **All applications**. | ||
|
||
![Assign User][201] | ||
|
||
2. In the applications list, select **Merchlogix**. | ||
|
||
![The Merchlogix link in the Applications list](./media/active-directory-saas-merchlogix-tutorial/tutorial_merchlogix_app.png) | ||
|
||
3. In the menu on the left, click **Users and groups**. | ||
|
||
![The "Users and groups" link][202] | ||
|
||
4. Click **Add** button. Then select **Users and groups** on **Add Assignment** dialog. | ||
|
||
![The Add Assignment pane][203] | ||
|
||
5. On **Users and groups** dialog, select **Britta Simon** in the Users list. | ||
|
||
6. Click **Select** button on **Users and groups** dialog. | ||
|
||
7. Click **Assign** button on **Add Assignment** dialog. | ||
|
||
### Test single sign-on | ||
|
||
In this section, you test your Azure AD single sign-on configuration using the Access Panel. | ||
|
||
When you click the Merchlogix tile in the Access Panel, you should get automatically signed-on to your Merchlogix application. | ||
For more information about the Access Panel, see [Introduction to the Access Panel](active-directory-saas-access-panel-introduction.md). | ||
|
||
## Additional resources | ||
|
||
* [List of Tutorials on How to Integrate SaaS Apps with Azure Active Directory](active-directory-saas-tutorial-list.md) | ||
* [What is application access and single sign-on with Azure Active Directory?](active-directory-appssoaccess-whatis.md) | ||
|
||
|
||
|
||
<!--Image references--> | ||
|
||
[1]: ./media/active-directory-saas-merchlogix-tutorial/tutorial_general_01.png | ||
[2]: ./media/active-directory-saas-merchlogix-tutorial/tutorial_general_02.png | ||
[3]: ./media/active-directory-saas-merchlogix-tutorial/tutorial_general_03.png | ||
[4]: ./media/active-directory-saas-merchlogix-tutorial/tutorial_general_04.png | ||
|
||
[100]: ./media/active-directory-saas-merchlogix-tutorial/tutorial_general_100.png | ||
|
||
[200]: ./media/active-directory-saas-merchlogix-tutorial/tutorial_general_200.png | ||
[201]: ./media/active-directory-saas-merchlogix-tutorial/tutorial_general_201.png | ||
[202]: ./media/active-directory-saas-merchlogix-tutorial/tutorial_general_202.png | ||
[203]: ./media/active-directory-saas-merchlogix-tutorial/tutorial_general_203.png | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
title: Sending user context to enable usage experiences in Azure Application Insights | Microsoft Docs | ||
description: Track how users move through your service after assigning each of them a unique, persistent ID string in Application Insights. | ||
services: application-insights | ||
documentationcenter: '' | ||
author: abgreg | ||
manager: carmonm | ||
|
||
ms.service: application-insights | ||
ms.workload: tbd | ||
ms.tgt_pltfrm: ibiza | ||
ms.devlang: csharp | ||
ms.topic: article | ||
ms.date: 08/02/2017 | ||
ms.author: cfreeman | ||
|
||
--- | ||
# Sending user context to enable usage experiences in Azure Application Insights | ||
|
||
## Tracking users | ||
|
||
Application Insights enables you to monitor and track your users through a set of product usage tools: | ||
* [Users, Sessions, Events](https://docs.microsoft.com/azure/application-insights/app-insights-usage-segmentation) | ||
* [Funnels](https://docs.microsoft.com/azure/application-insights/usage-funnels) | ||
* [Retention](https://docs.microsoft.com/azure/application-insights/app-insights-usage-retention) | ||
* Cohorts | ||
* [Workbooks](https://docs.microsoft.com/azure/application-insights/app-insights-usage-workbooks) | ||
|
||
In order to track what a user does over time, Application Insights needs an ID for each user or session. Include these IDs in every custom event or page view. | ||
- Users, Funnels, Retention, and Cohorts: Include user ID. | ||
- Sessions: Include session ID. | ||
|
||
If your app is integrated with the [JavaScript SDK](https://docs.microsoft.com/azure/application-insights/app-insights-javascript#set-up-application-insights-for-your-web-page), user ID is tracked automatically. | ||
|
||
## Choosing user IDs | ||
|
||
User IDs should persist across user sessions to track how users behave over time. There are various approaches for persisting the ID. | ||
- A definition of a user that you already have in your service. | ||
- If the service has access to a browser, it can pass the browser a cookie with an ID in it. The ID will persist for as long as the cookie remains in the user's browser. | ||
- If necessary, you can use a new ID each session, but the results about users will be limited. For example, you won't be able to see how a user's behavior changes over time. | ||
|
||
The ID should be a Guid or another string complex enough to identify each user uniquely. For example, it could be a long random number. | ||
|
||
If the ID contains personally identifying information about the user, it is not an appropriate value to send to Application Insights as a user ID. You can send such an ID as an [authenticated user ID](https://docs.microsoft.com/azure/application-insights/app-insights-api-custom-events-metrics#authenticated-users), but it does not fulfill the user ID requirement for usage scenarios. | ||
|
||
## ASP.NET Apps: Set user context in an ITelemetryInitializer | ||
|
||
Create a telemetry initializer, as described in detail [here](https://docs.microsoft.com/azure/application-insights/app-insights-api-filtering-sampling#add-properties-itelemetryinitializer), and set the Context.User.Id and the Context.Session.Id. | ||
|
||
This example sets the user ID to an identifier that expires after the session. If possible, use a user ID that persists across sessions. | ||
|
||
*C#* | ||
|
||
```C# | ||
|
||
using System; | ||
using System.Web; | ||
using Microsoft.ApplicationInsights.Channel; | ||
using Microsoft.ApplicationInsights.Extensibility; | ||
|
||
namespace MvcWebRole.Telemetry | ||
{ | ||
/* | ||
* Custom TelemetryInitializer that sets the user ID. | ||
* | ||
*/ | ||
public class MyTelemetryInitializer : ITelemetryInitializer | ||
{ | ||
public void Initialize(ITelemetry telemetry) | ||
{ | ||
// For a full experience, track each user across sessions. For an incomplete view of user | ||
// behavior within a session, store user ID on the HttpContext Session. | ||
// Set the user ID if we haven't done so yet. | ||
if (HttpContext.Current.Session["UserId"] == null) | ||
{ | ||
HttpContext.Current.Session["UserId"] = Guid.NewGuid(); | ||
} | ||
|
||
// Set the user id on the Application Insights telemetry item. | ||
telemetry.Context.User.Id = (string)HttpContext.Current.Session["UserId"]; | ||
|
||
// Set the session id on the Application Insights telemetry item. | ||
telemetry.Context.Session.Id = HttpContext.Current.Session.SessionID; | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Next steps | ||
- To enable usage experiences, start sending [custom events](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#trackevent) or [page views](https://docs.microsoft.com/azure/application-insights/app-insights-api-custom-events-metrics#page-views). | ||
- If you already send custom events or page views, explore the Usage tools to learn how users use your service. | ||
- [Users, Sessions, Events](https://docs.microsoft.com/azure/application-insights/app-insights-usage-segmentation) | ||
- [Funnels](https://docs.microsoft.com/azure/application-insights/usage-funnels) | ||
- [Retention](https://docs.microsoft.com/azure/application-insights/app-insights-usage-retention) | ||
- [Workbooks](https://docs.microsoft.com/azure/application-insights/app-insights-usage-workbooks) |