You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Azure Logic Apps填充并动态更新Azure IP-Group

Office 365 IP地址同步到Azure IP-Group的Logic Apps工作流优化需求

核心目标

  • 每日通过Azure Logic Apps向指定Office 365端点发送HTTP GET请求,获取全球公网IP地址列表
  • 仅提取IPv4地址,整理为规范的CSV格式后存储到Azure Blob Storage
  • 将CSV中的IPv4地址同步到Azure IP-Group(用于Azure Firewall),实现IP地址变更时的动态更新

已尝试的Logic Apps工作流代码

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Create_blob_(V2)": {
                "inputs": {
                    "body": "@triggerBody()",
                    "headers": {
                        "ReadFileMetadataFromServer": true
                    },
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['azureblob']['connectionId']"
                        }
                    },
                    "method": "post",
                    "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files",
                    "queries": {
                        "folderPath": "/project-a",
                        "name": "office365-test.csv",
                        "queryParametersSingleEncoded": true
                    }
                },
                "runAfter": {
                    "Create_job": [
                        "Succeeded"
                    ]
                },
                "runtimeConfiguration": {
                    "contentTransfer": {
                        "transferMode": "Chunked"
                    }
                },
                "type": "ApiConnection"
            },
            "Create_job": {
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['azureautomation']['connectionId']"
                        }
                    },
                    "method": "put",
                    "path": "/subscriptions/@{encodeURIComponent('xxxxxxxxxxxxxxxxxxxxxxxxx')}/resourceGroups/@{encodeURIComponent('xxxxxxx')}/providers/Microsoft.Automation/automationAccounts/@{encodeURIComponent('test')}/jobs",
                    "queries": {
                        "runbookName": "test-hello",
                        "wait": false,
                        "x-ms-api-version": "2015-10-31"
                    }
                },
                "runAfter": {},
                "type": "ApiConnection"
            },
            "Get_blob_content_using_path_(V2)": {
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['azureblob']['connectionId']"
                        }
                    },
                    "method": "get",
                    "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/GetFileContentByPath",
                    "queries": {
                        "inferContentType": true,
                        "path": "/project-a/office365-test.csv",
                        "queryParametersSingleEncoded": true
                    }
                },
                "runAfter": {
                    "Create_blob_(V2)": [
                        "Succeeded"
                    ]
                },
                "type": "ApiConnection"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {
            "$connections": {
                "defaultValue": {},
                "type": "Object"
            }
        },
        "triggers": {
            "HTTP": {
                "evaluatedRecurrence": {
                    "frequency": "Day",
                    "interval": 1
                },
                "inputs": {
                    "method": "GET",
                    "uri": "https://endpoints.office.com/endpoints/Worldwide?ClientRequestId=b10c5ed1-bad1-445f-b386-b919946339a7"
                },
                "recurrence": {
                    "frequency": "Day",
                    "interval": 1
                },
                "type": "Http"
            }
        }
    },
    "parameters": {
        "$connections": {
            "value": {
                "azureautomation": {
                    "connectionId": "/subscriptions/xxxxxx/resourceGroups/xxx/providers/Microsoft.Web/connections/azureautomation",
                    "connectionName": "azureautomation",
                    "id": "/subscriptions/xxxxxx/providers/Microsoft.Web/locations/uksouth/managedApis/azureautomation"
                },
                "azureblob": {
                    "connectionId": "/subscriptions/xxxxxx/resourceGroups/xxx/providers/Microsoft.Web/connections/azureblob",
                    "connectionName": "azureblob",
                    "id": "/subscriptions/xxxxxx/providers/Microsoft.Web/locations/uksouth/managedApis/azureblob"
                }
            }
        }
    }
}

当前存在的问题

  1. 工作流直接将原始API响应存入Blob Storage,未提取IPv4地址,导致CSV格式混乱,不符合需求
  2. 缺少将CSV中的IPv4地址同步到Azure IP-Group的步骤,无法实现IP地址的动态更新

内容的提问来源于stack exchange,提问作者user3137708

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 08:45:49