{"id":24610,"date":"2020-09-03T11:15:41","date_gmt":"2020-09-03T11:15:41","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=24610"},"modified":"2020-11-18T07:48:12","modified_gmt":"2020-11-18T07:48:12","slug":"impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/","title":{"rendered":"Impersonation within Azure Function or Custom Connector when using AAD authentication"},"content":{"rendered":"<p style=\"text-align: justify;\">In the earlier blog posts, we discussed <a href=\"https:\/\/www.inogic.com\/blog\/2020\/08\/building-custom-connectors-for-power-apps-and-power-automate-flows-part-1\/\" target=\"_blank\" rel=\"noopener noreferrer\">setting up an Azure function with AAD authentication<\/a> and then creating a custom connector for the Azure function that also requires AAD authentication to make a <a href=\"https:\/\/www.inogic.com\/blog\/2020\/08\/building-custom-connectors-for-power-apps-and-power-automate-flows-part-2\/\" target=\"_blank\" rel=\"noopener noreferrer\">connection to the connector<\/a>.<\/p>\n<p style=\"text-align: justify;\">Given that the Azure function is configured for AAD authentication in the Authentication \/ Authorization section of the function as shown below<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-24615 size-full\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1.png\" alt=\"Azure Function or Custom Connector when using AAD authentication\" width=\"1340\" height=\"692\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1.png 1340w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1-300x155.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1-768x397.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1-1024x529.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1-660x341.png 660w\" sizes=\"(max-width: 1340px) 100vw, 1340px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">Now that we have provided for AAD authentication that requires a user login, it would be good if all operations are executed within the context of the same user.<\/p>\n<p style=\"text-align: justify;\">Within your Azure function, you can get the details of the logged-in user using the <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/azure-functions\/functions-bindings-http-webhook-trigger?tabs=csharp#working-with-client-identities\" target=\"_blank\" rel=\"noopener noreferrer\">ClaimsPrincipal<\/a><\/p>\n<p>ClaimsPrincipal principal = req.HttpContext.User;<\/p>\n<p>if (principal.Identity != null)<\/p>\n<p>{<\/p>\n<p style=\"padding-left: 40px;\">log.LogInformation(&#8220;Claims identity &#8221; + principal.Identity.Name);<\/p>\n<p>}<\/p>\n<p>if (principal.Claims != null)<\/p>\n<p>{<\/p>\n<p style=\"padding-left: 40px;\">foreach (Claim c in principal.Claims)<\/p>\n<p style=\"padding-left: 40px;\">{<\/p>\n<p style=\"padding-left: 80px;\">log.LogInformation(&#8220;CLAIM TYPE: &#8221; + c.Type + &#8220;; CLAIM VALUE: &#8221; + c.Value + &#8220;&lt;\/br&gt;&#8221;);<\/p>\n<p style=\"padding-left: 40px;\">}<\/p>\n<p>\u00a0}<\/p>\n<p>In the console, you can see all the claims returned<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-2.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-24613 size-full\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-2.png\" alt=\"Azure Function or Custom Connector when using AAD authentication\" width=\"2438\" height=\"1852\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-2.png 2438w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-2-300x228.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-2-768x583.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-2-1024x778.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-2-660x501.png 660w\" sizes=\"(max-width: 2438px) 100vw, 2438px\" \/><\/a><\/p>\n<p>One of the claims returned is AADID<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-3.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-24614 size-full\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-3.png\" alt=\"Azure Function or Custom Connector when using AAD authentication\" width=\"2438\" height=\"66\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-3.png 2438w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-3-300x8.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-3-768x21.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-3-1024x28.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-3-660x18.png 660w\" sizes=\"(max-width: 2438px) 100vw, 2438px\" \/><\/a><\/p>\n<p>Read this specific claim value<\/p>\n<p>Claim claim = principal.Claims.FirstOrDefault(c =&gt; c.Type.Contains(&#8220;objectidentifier&#8221;));<\/p>\n<p>string aadobjid = &#8220;&#8221;;<\/p>\n<p>if (claim != null)<\/p>\n<p>{<\/p>\n<p style=\"padding-left: 40px;\">aadobjid = claim.Value;<\/p>\n<p style=\"padding-left: 40px;\">log.LogInformation(&#8220;aadobjid = &#8221; + aadobjid);<\/p>\n<p>}<\/p>\n<p>Every CRM User that we create has an associated AADID stored along which is this objectid.<\/p>\n<p>Set this to the cds client object we have created for impersonation<\/p>\n<p>\/\/establish connection with CDS<\/p>\n<p>CdsServiceClient client = new CdsServiceClient(connectionString);<\/p>\n<p>if (!string.IsNullOrEmpty(aadobjid))<\/p>\n<p>{<\/p>\n<p style=\"padding-left: 40px;\">client.CallerAADObjectId = new Guid(aadobjid);<\/p>\n<p>}<\/p>\n<p style=\"text-align: justify;\">Do note if you run a WhoAmI request \u2013 it still returns the id of the original credentials used for establishing the connection.<\/p>\n<p>However, when you create a record, you will notice that the owner of the new record is the same user that had logged in to the connector.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the earlier blog posts, we discussed setting up an Azure function with AAD authentication and then creating a custom connector for the Azure function that also requires AAD authentication to make a connection to the connector. Given that the Azure function is configured for AAD authentication in the Authentication \/ Authorization section of the\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/\">Read More: Impersonation within Azure Function or Custom Connector when using AAD\u2026 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":24621,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,2088],"tags":[2070,2071,2089,545],"class_list":["post-24610","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure-functions","category-custom-connector","tag-aad-authentication","tag-azure-function","tag-custom-connector","tag-dynamics-365-crm"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"In the earlier blog posts, we discussed setting up an Azure function with AAD authentication and then creating a custom connector for the Azure function that also requires AAD authentication to make a connection to the connector. Given that the Azure function is configured for AAD authentication in the Authentication \/ Authorization section of the\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Inogic\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Microsoft Dynamics 365 CRM Tips and Tricks - By Inogic\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Impersonation within Azure Function or Custom Connector when using AAD authentication - Microsoft Dynamics 365 CRM Tips and Tricks\" \/>\n\t\t<meta property=\"og:description\" content=\"In the earlier blog posts, we discussed setting up an Azure function with AAD authentication and then creating a custom connector for the Azure function that also requires AAD authentication to make a connection to the connector. Given that the Azure function is configured for AAD authentication in the Authentication \/ Authorization section of the\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1.png\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1340\" \/>\n\t\t<meta property=\"og:image:height\" content=\"692\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-09-03T11:15:41+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-11-18T07:48:12+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inogicindia\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@inogic\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Impersonation within Azure Function or Custom Connector when using AAD authentication - Microsoft Dynamics 365 CRM Tips and Tricks\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In the earlier blog posts, we discussed setting up an Azure function with AAD authentication and then creating a custom connector for the Azure function that also requires AAD authentication to make a connection to the connector. Given that the Azure function is configured for AAD authentication in the Authentication \/ Authorization section of the\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@inogic\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1.png\" \/>\n\t\t<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t\t<meta name=\"twitter:data1\" content=\"Inogic\" \/>\n\t\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#blogposting\",\"name\":\"Impersonation within Azure Function or Custom Connector when using AAD authentication - Microsoft Dynamics 365 CRM Tips and Tricks\",\"headline\":\"Impersonation within Azure Function or Custom Connector when using AAD authentication\",\"author\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication.png\",\"width\":150,\"height\":150,\"caption\":\"Impersonation within Azure Function or Custom Connector when using AAD authentication\"},\"datePublished\":\"2020-09-03T11:15:41+05:30\",\"dateModified\":\"2020-11-18T07:48:12+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#webpage\"},\"articleSection\":\"Azure Functions, Custom Connector, AAD Authentication, Azure Function, Custom Connector, Dynamics 365 CRM\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.inogic.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/azure-functions\\\/#listItem\",\"name\":\"Azure Functions\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/azure-functions\\\/#listItem\",\"position\":2,\"name\":\"Azure Functions\",\"item\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/azure-functions\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#listItem\",\"name\":\"Impersonation within Azure Function or Custom Connector when using AAD authentication\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#listItem\",\"position\":3,\"name\":\"Impersonation within Azure Function or Custom Connector when using AAD authentication\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/category\\\/azure-functions\\\/#listItem\",\"name\":\"Azure Functions\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\",\"name\":\"Microsoft Dynamics 365 CRM Tips and Tricks\",\"description\":\"By Inogic\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/inogic-logo.png\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#organizationLogo\",\"width\":1000,\"height\":325,\"caption\":\"inogic logo\"},\"image\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/inogicindia\",\"https:\\\/\\\/twitter.com\\\/inogic\",\"https:\\\/\\\/www.instagram.com\\\/inogicindia\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCM4V7ousgLSu1hbOEv4DUuQ\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/inogicindia\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/\",\"name\":\"Inogic\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/839d9ae7d2b941d2d09e91df322267a429821f2ce5494302b53bd5ca3679f1a0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Inogic\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#webpage\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/\",\"name\":\"Impersonation within Azure Function or Custom Connector when using AAD authentication - Microsoft Dynamics 365 CRM Tips and Tricks\",\"description\":\"In the earlier blog posts, we discussed setting up an Azure function with AAD authentication and then creating a custom connector for the Azure function that also requires AAD authentication to make a connection to the connector. Given that the Azure function is configured for AAD authentication in the Authentication \\\/ Authorization section of the\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/author\\\/inogic-2\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication.png\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#mainImage\",\"width\":150,\"height\":150,\"caption\":\"Impersonation within Azure Function or Custom Connector when using AAD authentication\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/2020\\\/09\\\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\\\/#mainImage\"},\"datePublished\":\"2020-09-03T11:15:41+05:30\",\"dateModified\":\"2020-11-18T07:48:12+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/\",\"name\":\"Microsoft Dynamics 365 CRM Tips and Tricks\",\"alternateName\":\"Inogic\",\"description\":\"By Inogic\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.inogic.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Impersonation within Azure Function or Custom Connector when using AAD authentication - Microsoft Dynamics 365 CRM Tips and Tricks","description":"In the earlier blog posts, we discussed setting up an Azure function with AAD authentication and then creating a custom connector for the Azure function that also requires AAD authentication to make a connection to the connector. Given that the Azure function is configured for AAD authentication in the Authentication \/ Authorization section of the","canonical_url":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#blogposting","name":"Impersonation within Azure Function or Custom Connector when using AAD authentication - Microsoft Dynamics 365 CRM Tips and Tricks","headline":"Impersonation within Azure Function or Custom Connector when using AAD authentication","author":{"@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author"},"publisher":{"@id":"https:\/\/www.inogic.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication.png","width":150,"height":150,"caption":"Impersonation within Azure Function or Custom Connector when using AAD authentication"},"datePublished":"2020-09-03T11:15:41+05:30","dateModified":"2020-11-18T07:48:12+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#webpage"},"isPartOf":{"@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#webpage"},"articleSection":"Azure Functions, Custom Connector, AAD Authentication, Azure Function, Custom Connector, Dynamics 365 CRM"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.inogic.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/#listItem","name":"Azure Functions"}},{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/#listItem","position":2,"name":"Azure Functions","item":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#listItem","name":"Impersonation within Azure Function or Custom Connector when using AAD authentication"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#listItem","position":3,"name":"Impersonation within Azure Function or Custom Connector when using AAD authentication","previousItem":{"@type":"ListItem","@id":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/#listItem","name":"Azure Functions"}}]},{"@type":"Organization","@id":"https:\/\/www.inogic.com\/blog\/#organization","name":"Microsoft Dynamics 365 CRM Tips and Tricks","description":"By Inogic","url":"https:\/\/www.inogic.com\/blog\/","logo":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/02\/inogic-logo.png","@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#organizationLogo","width":1000,"height":325,"caption":"inogic logo"},"image":{"@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#organizationLogo"},"sameAs":["https:\/\/www.facebook.com\/inogicindia","https:\/\/twitter.com\/inogic","https:\/\/www.instagram.com\/inogicindia\/","https:\/\/www.youtube.com\/channel\/UCM4V7ousgLSu1hbOEv4DUuQ","https:\/\/www.linkedin.com\/company\/inogicindia"]},{"@type":"Person","@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author","url":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/","name":"Inogic","image":{"@type":"ImageObject","@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/839d9ae7d2b941d2d09e91df322267a429821f2ce5494302b53bd5ca3679f1a0?s=96&d=mm&r=g","width":96,"height":96,"caption":"Inogic"}},{"@type":"WebPage","@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#webpage","url":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/","name":"Impersonation within Azure Function or Custom Connector when using AAD authentication - Microsoft Dynamics 365 CRM Tips and Tricks","description":"In the earlier blog posts, we discussed setting up an Azure function with AAD authentication and then creating a custom connector for the Azure function that also requires AAD authentication to make a connection to the connector. Given that the Azure function is configured for AAD authentication in the Authentication \/ Authorization section of the","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.inogic.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#breadcrumblist"},"author":{"@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author"},"creator":{"@id":"https:\/\/www.inogic.com\/blog\/author\/inogic-2\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication.png","@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#mainImage","width":150,"height":150,"caption":"Impersonation within Azure Function or Custom Connector when using AAD authentication"},"primaryImageOfPage":{"@id":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/#mainImage"},"datePublished":"2020-09-03T11:15:41+05:30","dateModified":"2020-11-18T07:48:12+05:30"},{"@type":"WebSite","@id":"https:\/\/www.inogic.com\/blog\/#website","url":"https:\/\/www.inogic.com\/blog\/","name":"Microsoft Dynamics 365 CRM Tips and Tricks","alternateName":"Inogic","description":"By Inogic","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.inogic.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Microsoft Dynamics 365 CRM Tips and Tricks - By Inogic","og:type":"article","og:title":"Impersonation within Azure Function or Custom Connector when using AAD authentication - Microsoft Dynamics 365 CRM Tips and Tricks","og:description":"In the earlier blog posts, we discussed setting up an Azure function with AAD authentication and then creating a custom connector for the Azure function that also requires AAD authentication to make a connection to the connector. Given that the Azure function is configured for AAD authentication in the Authentication \/ Authorization section of the","og:url":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/","og:image":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1.png","og:image:secure_url":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1.png","og:image:width":1340,"og:image:height":692,"article:published_time":"2020-09-03T11:15:41+00:00","article:modified_time":"2020-11-18T07:48:12+00:00","article:publisher":"https:\/\/www.facebook.com\/inogicindia","twitter:card":"summary_large_image","twitter:site":"@inogic","twitter:title":"Impersonation within Azure Function or Custom Connector when using AAD authentication - Microsoft Dynamics 365 CRM Tips and Tricks","twitter:description":"In the earlier blog posts, we discussed setting up an Azure function with AAD authentication and then creating a custom connector for the Azure function that also requires AAD authentication to make a connection to the connector. Given that the Azure function is configured for AAD authentication in the Authentication \/ Authorization section of the","twitter:creator":"@inogic","twitter:image":"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/09\/Impersonation-within-Azure-Function-or-Custom-Connector-when-using-AAD-authentication-1.png","twitter:label1":"Written by","twitter:data1":"Inogic","twitter:label2":"Est. reading time","twitter:data2":"1 minute"},"aioseo_meta_data":{"post_id":"24610","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-02-02 07:31:55","updated":"2025-07-04 07:53:18","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.inogic.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/\" title=\"Azure Functions\">Azure Functions<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tImpersonation within Azure Function or Custom Connector when using AAD authentication\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.inogic.com\/blog"},{"label":"Azure Functions","link":"https:\/\/www.inogic.com\/blog\/category\/azure-functions\/"},{"label":"Impersonation within Azure Function or Custom Connector when using AAD authentication","link":"https:\/\/www.inogic.com\/blog\/2020\/09\/impersonation-within-azure-function-or-custom-connector-when-using-aad-authentication\/"}],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/24610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=24610"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/24610\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/24621"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=24610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=24610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=24610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}