我编写了以下Power BI函数,使我可以在给定的Azure函数服务中获取所有函数。
let
Source = (subscriptionId as text, resourceGroup as text, functionApp as text) => let
Url = Text.Format(
"https://management.azure.com/subscriptions/#{0}/resourceGroups/#{1}/providers/Microsoft.Web/sites/#{2}/functions?api-version=2018-02-01",
{subscriptionId, resourceGroup, functionApp}
),
Source = Web.Contents(Url),
Data = Json.Document(Source),
Body = Data[value],
FunctionTable = Table.FromList(Body, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Fields" = Table.ExpandRecordColumn(
FunctionTable,
"Column1",
{"id", "name", "properties"},
{"Id", "Function FQ Name", "properties"}
),
#"Expanded properties" = Table.ExpandRecordColumn(
Fields,
"properties",
{"name", "config", "invoke_url_template", "language", "isDisabled"},
{"Function Name", "config", "Url Template", "Language", "Disabled"}
),
#"Removed Columns" = Table.RemoveColumns(#"Expanded properties",{"Function FQ Name"}),
#"Expanded config" = Table.ExpandRecordColumn(#"Removed Columns", "config", {"configurationSource", "bindings", "entryPoint"}, {"config.configurationSource", "config.bindings", "config.entryPoint"}),
#"Extracted Values" = Table.TransformColumns(
#"Expanded config",
{"config.bindings", each _{0}}
),
#"Expanded config.bindings" = Table.ExpandRecordColumn(
#"Extracted Values",
"config.bindings",
{"type", "methods", "authLevel", "schedule", "runOnStartup", "connection", "path", "queueName"},
{"Binding Type", "Binding Methods", "Binding Auth Level", "Schedule", "Run On Startup", "Connection", "Binding Path", "Queue"})
in
#"Expanded config.bindings"
in
Source
在我的组织中,所有计时器触发值的时间表都是在应用程序设置(如%Function.Timer.Value%)中设置的变量,因此可以在不更改代码的情况下设置时间表。
要获取应用设置,我必须发送POST而不是发送https://management.azure.com/subscriptions/__SUBSCRIPTION_ID__/resourceGroups/__RESOURCE_GROUP__/providers/Microsoft.Web/sites/__FUNC_APP_NAME__/config/appsettings/list?api-version=2018-02-01
的GET的问题,如果这样做,我会收到错误消息:
“ GetAzureFunctionAppConfig”查询中发生错误。 DataSource.Error:仅在匿名连接时才支持带有Content选项的Web.Contents
是否可以在PowerBI中获取应用设置?