api 连接无法通过二头肌使用logicapp 连接到自动化帐户

问题描述 投票:0回答:1

resource workflows_newlogic06_name_resource 'Microsoft.Logic/workflows@2016-06-01' = {
  name: workflows_newlogic06_name
  location:location
  properties: {
    state: 'Enabled'
    definition: {
      '$schema': 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#'
      contentVersion: '1.0.0.0'
      parameters: {
        '$connections': {
          defaultValue: {}
          type: 'Object'
        }
      }
      triggers: {
        Recurrence: {
          recurrence: {
            frequency: 'Month'
            interval: 3
          }
          evaluatedRecurrence: {
            frequency: 'Month'
            interval: 3
          }
          type: 'Recurrence'
        }
      }
      actions: {
        Create_job: {
          runAfter: {}
          type: 'ApiConnection'
          inputs: {
            host: {
              connection: {
                name: '@parameters(\'$connections\')[\'azureautomation_1\'][\'connectionId\']'
              }
            }
            method: 'put'
            path: '/subscriptions/@{encodeURIComponent(\'${subscriptionid}\')}/resourceGroups/@{encodeURIComponent(\'nextone1\')}/providers/Microsoft.Automation/automationAccounts/@{encodeURIComponent(\'newauto01\')}/jobs'
            queries: {
              wait: true
              'x-ms-api-version': '2015-10-31'
            }
          }
        }
        Get_job_output: {
          runAfter: {
            Create_job: [
              'Succeeded'
            ]
          }
          type: 'ApiConnection'
          inputs: {
            host: {
              connection: {
                name: '@parameters(\'$connections\')[\'azureautomation_1\'][\'connectionId\']'
              }
            }
            method: 'get'
            path: '/subscriptions/@{encodeURIComponent(\'{subscriptionid}\')}/resourceGroups/@{encodeURIComponent(\'nextone1\')}/providers/Microsoft.Automation/automationAccounts/@{encodeURIComponent(\'newauto01\')}/jobs/@{encodeURIComponent(body(\'Create_job\')?[\'properties\']?[\'jobId\'])}/output'
            queries: {
              'x-ms-api-version': '2015-10-31'
            }
          }
        }
      }
      outputs: {}
    }
    parameters: {
      '$connections': {
        value: {
          azureautomation_1: {
            connectionId: connections_azureautomation_externalid
            connectionName: 'azureautomation'
            id: '/subscriptions/{subscriptionid}/providers/Microsoft.Web/locations/eastus/managedApis/azureautomation'
          }
        }
      }
    }
  }
}
resource connections_azureautomation_name_resource 'Microsoft.Web/connections@2016-06-01' = {
  name: connections_azureautomation_name
  location: location
  properties: {
    displayName: 'new-c0n-01'
    statuses: [
      {
        status: 'Ready'
      }
    ]
    customParameterValues: {}
    createdTime: '2023-09-26T11:35:24.8852931Z'
    changedTime: '2023-09-26T11:35:24.8852931Z'
    api: {
      name: connections_azureautomation_name
      displayName: 'Azure Automation'
      description: 'Azure Automation provides tools to manage your cloud and on-premises infrastructure seamlessly.'
      iconUri: 'https://connectoricons-prod.azureedge.net/u/shgogna/globalperconnector-train1/1.0.1639.3312/${connections_azureautomation_name}/icon.png'
      brandColor: '#56A0D7'
      id:subscriptionResourceId('Microsoft.web/locations/managedApis', location, 'azureautomation')
      type: 'Microsoft.Web/locations/managedApis'
      }
  }
}

我需要什么? 使用二头肌创建了 azure 自动化帐户、Runbook、逻辑应用程序以及 api 连接。部署成功,但逻辑应用程序连接尚未建立,尝试了很长时间,感到沮丧,有人帮助我找出这些问题吗?谢谢

尝试了多种方法找到解决方案设置parametervalueType='alternative'无法解决。

azure-devops azure-logic-apps azure-devops-rest-api azure-bicep azure-api-apps
1个回答
0
投票

Api 连接无法通过二头肌使用逻辑应用程序连接到自动化帐户:-

分析你的代码后,它对我来说看起来不错,但我做了一些更改并在下面附上了修改后的代码。

较旧的 Api 版本可能会出现此类连接问题。因此,请始终使用最新的

Api version
'Microsoft.Logic/workflows@2019-05-01
.

param location string = resourceGroup().location
param subscriptionid string = 'xxxxx'
param connections_azureautomation_name string = 'jahconn'
resource workflows_newlogic06_name_resource 'Microsoft.Logic/workflows@2019-05-01' = {
  name: 'newwf'
  location:location
  properties: {
    state: 'Enabled'
    definition: {
      '$schema': 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#'
      contentVersion: '1.0.0.0'
      parameters: {
        '$connections': {
          defaultValue: {}
          type: 'Object'
        }
      }
      triggers: {
        Recurrence: {
          recurrence: {
            frequency: 'Month'
            interval: 3
          }
          evaluatedRecurrence: {
            frequency: 'Month'
            interval: 3
          }
          type: 'Recurrence'
        }
      }
      actions: {
        Create_job: {
          runAfter: {}
          type: 'ApiConnection'
          inputs: {
            host: {
              connection: {
                name: '@parameters(\'$connections\')[\'azureautomation_1\'][\'connectionId\']'
              }
            }
            method: 'put'
            path: '/subscriptions/@{encodeURIComponent(\'${subscriptionid}\')}/resourceGroups/@{encodeURIComponent(\'nextone1\')}/providers/Microsoft.Automation/automationAccounts/@{encodeURIComponent(\'newauto01\')}/jobs'
            queries: {
              wait: true
              'x-ms-api-version': '2015-10-31'
            }
          }
        }
        Get_job_output: {
          runAfter: {
            Create_job: [
              'Succeeded'
            ]
          }
          type: 'ApiConnection'
          inputs: {
            host: {
              connection: {
                name: '@parameters(\'$connections\')[\'azureautomation_1\'][\'connectionId\']'
              }
            }
            method: 'get'
            path: '/subscriptions/@{encodeURIComponent(\'{subscriptionid}\')}/resourceGroups/@{encodeURIComponent(\'nextone1\')}/providers/Microsoft.Automation/automationAccounts/@{encodeURIComponent(\'newauto01\')}/jobs/@{encodeURIComponent(body(\'Create_job\')?[\'properties\']?[\'jobId\'])}/output'
            queries: {
              'x-ms-api-version': '2015-10-31'
            }
          }
        }
      }
      outputs: {}
    }
    parameters: {
      '$connections': {
        value: {
          azureautomation_1: {
            connectionName: 'azureautomation'
            connectionId: resourceId('Microsoft.Web/connections', connections_azureautomation_name)
            id: '/subscriptions/{subscriptionid}/providers/Microsoft.Web/locations/eastus/managedApis/azureautomation'
          }
        }
      }
    }
  }
}
resource connections_azureautomation_name_resource 'Microsoft.Web/connections@2016-06-01' = {
  name: connections_azureautomation_name
  location: location
  properties: {
    displayName: 'new-c0n-01'
    statuses: [
      {
        status: 'Ready'
      }
    ]
    customParameterValues: {}
    createdTime: '2023-09-26T11:35:24.8852931Z'
    changedTime: '2023-09-26T11:35:24.8852931Z'
    api: {
      name: connections_azureautomation_name
      displayName: 'Azure Automation'
      description: ''
      iconUri: 'https://connectoricons-prod.azureedge.net/u/shgogna/globalperconnector-train1/1.0.1639.3312/${connections_azureautomation_name}/icon.png'
      brandColor: '#56A0D7'
      id:subscriptionResourceId('Microsoft.web/locations/managedApis', location, 'azureautomation')
      type: 'Microsoft.Web/locations/managedApis'
      }
  }
}

部署成功:

enter image description here

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.