azure - 获取Azure时间触发函数的当前函数名称

标签 azure powershell azure-functions

我正在尝试访问函数应用时间触发器中同一函数文件夹中的文件。我正在使用 Powershell 代码。

如何访问该文件

在 HTTP 触发器中,我可以通过执行此操作来访问同一文件夹中的脚本

$script_path = ".$($TriggerMetadata.FunctionName)\scriptfile.ps1"

但是,如果我使用时间触发函数,则这不起作用,因为触发函数时未传递 $TriggerMetadata。

我想要一种能够动态获取时间触发器的函数名称的方法,以便我可以访问同一文件夹中的脚本。

我该怎么做?

最佳答案

试试这个:

# Get the current directory path
$currentPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition

# Construct the file path for your script
$scriptPath = Join-Path -Path $currentPath -ChildPath "scriptfile.ps1"

# Use the $scriptPath to access the file

关于azure - 获取Azure时间触发函数的当前函数名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76586356/

相关文章:

performance - Azure 中的 Application Insight 性能计数器

asp.net - 我可以在 IIS 上部署 Azure 项目吗?

.net - 深度复制PSObject

Powershell Invoke-RestMethod 不正确的字符

json - 在 Azure 数据工厂中发送 JSON 文件

azure - 通过 terraform 将主访问 key 从存储添加到 KV

powershell - 如何将变量传递给满足ValidateSet的函数?

visual-studio - Azure Functions Visual Studio 2015 智能感知

在 Terraform 中使用 azurerm_runction_app_function 时,Azure 函数 Url 不包含身份验证代码

Azure Durable Functions 作为消息队列