【Azure 应用服务】Storage Queue触发Azure Function时报错 The input is not a valid Base-64 string
问题描述
创建一个PowerShell脚本的Azure Function,触发方式为 Storage Queue。但执行函数结果一直失败 (Failed).
错误消息为:
Executed 'Functions.QueueTrigger1' (Failed, Id=..., Duration=30ms) The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
Funciton 代码:
# Input bindings are passed in via param block.
param([string] $QueueItem, $TriggerMetadata) # Write out the queue message and metadata to the information log.
Write-Host "PowerShell queue trigger function processed work item: $QueueItem"
Write-Host "Queue item expiration time: $($TriggerMetadata.ExpirationTime)"
Write-Host "Queue item insertion time: $($TriggerMetadata.InsertionTime)"
Write-Host "Queue item next visible time: $($TriggerMetadata.NextVisibleTime)"
Write-Host "ID: $($TriggerMetadata.Id)"
Write-Host "Pop receipt: $($TriggerMetadata.PopReceipt)"
Write-Host "Dequeue count: $($TriggerMetadata.DequeueCount)"
通过向Storage Queue中添加消息时候触发:
az storage message put --content "This is a function test message"
问题分析
根据错误消息,Function (Storage Queue)触发的消息需要 Base64编码,如发送 "This is a function test message" 这段消息,需要在发送消息时候转换为base64编码。

在CMD中调用PowerShell进行类型转换:
powershell "[convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"This is a function test message\"))"
在Powershell中直接转换:
[convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("This is a function test message"))
所以,修改后的向Storage Queue中添加消息的命令为:
$queuemsg = [convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("This is a function test message"))
az storage message put --content $queuemsg
参考资料
适用于 Azure Functions 的 Azure 队列存储触发器: https://docs.azure.cn/zh-cn/azure-functions/functions-bindings-storage-queue-trigger?tabs=powershell#encoding
【Azure 应用服务】Storage Queue触发Azure Function时报错 The input is not a valid Base-64 string的更多相关文章
- 【Azure 应用服务】部署Kafka Trigger Function到Azure Function服务中,解决自定义域名解析难题
问题描述 经过前两篇文章,分别使用VM搭建了Kafka服务,创建了Azure Function项目,并且都在本地运行成功. [Azure Developer]在Azure VM (Windows) 中 ...
- Azure File Storage 基本用法 -- Azure Storage 之 File
Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在<Azure Blob Storage 基 ...
- Azure Blob Storage 基本用法 -- Azure Storage 之 Blob
Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在<Azure Table storage ...
- Azure Table storage 基本用法 -- Azure Storage 之 Table
Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table,其中的 Table 就是本文的主角 Azure Tabl ...
- 【Azure 应用服务】App Service/Azure Function的出站连接过多而引起了SNAT端口耗尽,导致一些新的请求出现超时错误(Timeout)
问题描述 当需要在应用中有大量的出站连接时候,就会涉及到SNAT(源地址网络转换)耗尽的问题.而通过Azure App Service/Function的默认监控指标图表中,却没有可以直接查看到SNA ...
- 使用版本 1.0.0 的 Azure ARM SDK for Java 创建虚拟机时报错
问题描述 我们可以通过使用 Azure ARM SDK 来管理 Azure 上的资源,因此我们也可以通过 SDK 来创建 ARM 类型的虚拟机,当我们使用 1.0.0 版本的 Azure SDK fo ...
- 【Azure 应用服务】探索在Azure上设置禁止任何人访问App Service的默认域名(Default URL)
问题描述 总所周知,Azure App Service服务会默认提供一个 ***.chinacloudsites.cn为后缀的域名,但是该域名由上海蓝云网络科技有限公司备案,仅用于向其客户提供 Azu ...
- hive udaf 用maven打包运行create temporary function 时报错
用maven打包写好的jar,在放到hive中作暂时函数时报错. 错误信息例如以下: hive> create temporary function maxvalue as "com. ...
- 【Azure 应用服务】本地创建Azure Function Kafka Trigger 函数和Kafka output的HTTP Trigger函数实验
问题描述 在上一篇博文(https://www.cnblogs.com/lulight/p/16525902.html)中,我们成功的以VM作为Kafka服务器运行,并且验证了从其他机器中远程访问.在 ...
- 远程访问Function时报错Remote table-valued function calls are not allowed.
开始是这样调用的:select * from [LinkedServer].[db name].dbo.[function name](param1, param2) 原因: Only table-v ...
随机推荐
- K8S多节点情况下使用nginx负载ingress或者是istio域名服务的处理
K8S多节点情况下使用nginx负载ingress或者是istio域名服务的处理 背景 公司内部有一个自建的K8S测试集群.同事这边使用istio或者是ingress发布了一个域名服务. 公司这边的D ...
- 最简单的以CentOS为base images 安装 Nodejs等操作的方法
镜像内安装NodeJS的简单方法 公司内有产品需要安装nodejs以便进行相关操作,Linux和Windows时没有问题,但是如果是镜像的话可能会稍微复杂一点, 这里简单进行一下总结, 以便备忘. 1 ...
- RIPEMD加密技术探究:优势、劣势与实战应用
摘要:RIPEMD加密算法作为一种哈希算法,自1989年诞生以来,因其高效.安全的特性在网络安全领域得到了广泛的应用.本文将对RIPEMD算法的优缺点进行详细分析,并给出一个Java完整的示例代码.同 ...
- Leetcode 98题验证二叉搜索树(Validate Binary Search Tree) Java语言求解
题目链接 https://leetcode-cn.com/problems/validate-binary-search-tree/ 题目内容 给定一个二叉树,判断其是否是一个有效的二叉搜索树. 假设 ...
- net core控制台程序使用依赖注入读取appsettings.json配置文件
.net 2.1有用,转自https://www.jianshu.com/p/726d1aa2795c 1.项目下添加appsettings.json文件,并将属性-复制到输出目录,设置为如果较新则复 ...
- 释放搜索潜力:基于ES(ElasticSearch)打造高效的语义搜索系统,让信息尽在掌握
释放搜索潜力:基于ES(ElasticSearch)打造高效的语义搜索系统,让信息尽在掌握[1.安装部署篇--简洁版],支持Linux/Windows部署安装 效果展示 PaddleNLP Pipel ...
- python编程中,各种随机种子seed设置总结
python随机种子seed的作用(强化学习常用到)_汀.的博客-CSDN博客先上代码import mathimport gymfrom gym import spaces, loggerfrom g ...
- 4.基于Label studio的训练数据标注指南:情感分析任务观点词抽取、属性抽取
情感分析任务Label Studio使用指南 1.基于Label studio的训练数据标注指南:信息抽取(实体关系抽取).文本分类等 2.基于Label studio的训练数据标注指南:(智能文档) ...
- CE修改器入门:浮点数的扫描
在前面的教程中我们使用4字节的方式进行扫描,但有些游戏使用了"浮点数"来存储数值,浮点数是带有小数点的数值(如 5.12 或 11321.1),正如本关中的健康和弹药,两者都以浮点 ...
- SpringBoot 多模块开发 笔记(一)
多模块开发 简易版 dao 层 也可以说是 Mapper 层 web 层 将 controller 放在这一层 还有 统一返回类型 和 自定义异常 也在放在这里 启动类也放在这里 model 层 也就 ...