Azure Logic App with SharePoint Connection

两盒软妹~` 提交于 2020-12-13 03:05:34

问题


I am creating my first logic app which connects to SharePoint and adds entries into some sharepoint list.

Whenever I create a SharePoint Connection it adds below resource to my logic app.

{
  "type": "MICROSOFT.WEB/CONNECTIONS",
  "apiVersion": "2018-07-01-preview",
  "name": "[parameters('sharepointonline_1_Connection_Name')]",
  "location": "[parameters('logicAppLocation')]",
  "properties": {
    "api": {
      "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'sharepointonline')]"
    },
    "displayName": "[parameters('sharepointonline_1_Connection_DisplayName')]",
    "nonSecretParameterValues": {
      "token:TenantId": "[parameters('sharepointonline_1_token:TenantId')]"
    }
  }

Could anyone give an explanation of "token:TenantId". How/where to get this value in my dev tenant. How this can be moved to UAT/PROD environment?

Whenever I recreate my logic app with the SharePoint connection it loses the connection and shows me below screen with a warning icon.

Is there a way we can authenticate this connection via PowerShell or via Azure DevOps deployment?


回答1:


This seems to the OAuth connection and will need to be re-authorized after the template deployment to obtain valid access token. Some connections support using an Azure Active Directory (Azure AD) service principal to authorize connections for a logic app that's registered in Azure AD.

Documentation here shows how Azure data lake's connection resource definition can be configured to use parameter values of the template and Azure AD service principal to generate the token so you might want to check if SharePoint connection can be configured in same way or not.

{
   <other-template-objects>
   "type": "MICROSOFT.WEB/CONNECTIONS",
   "apiVersion": "2016-06-01",
   "name": "[parameters('azuredatalake_1_Connection_Name')]",
   "location": "[parameters('LogicAppLocation')]",
   "properties": {
      "api": {
         "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', 'resourceGroup().location', '/managedApis/', 'azuredatalake')]"
      },
      "displayName": "[parameters('azuredatalake_1_Connection_DisplayName')]",
      "parameterValues": {
         "token:clientId": "[parameters('azuredatalake_1_token:clientId')]",
         "token:clientSecret": "[parameters('azuredatalake_1_token:clientSecret')]",
         "token:TenantId": "[parameters('azuredatalake_1_token:TenantId')]",
         "token:grantType": "[parameters('azuredatalake_1_token:grantType')]"
      }
   }
}

Reference: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-azure-resource-manager-templates-overview#authenticate-connections



来源:https://stackoverflow.com/questions/60230373/azure-logic-app-with-sharepoint-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!