- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下要求
1. XML file need to read from SharePoint and copy into Azure Blob.
2. Need to use Logic app to read the file from share point and copy into Azure Blob.
3. Before copy into Azure Blob need to encrypt the data in Logic app.
如果有任何建议,请告诉我。
最佳答案
据我所知,这里没有任何现成的帮助。您将需要编写一个 Azure 函数(或 REST 端点)来执行加密并从您的逻辑应用程序调用该函数。
这样的函数有很多例子,you can find one for PGP here 。下面复制了核心功能以及微软的指导calling functions from Logic Apps is here .
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using PgpCore;
using System.Threading.Tasks;
using Microsoft.Azure.KeyVault.Models;
using System.Net.Http;
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Azure.KeyVault;
using System;
using System.Text;
using System.Collections.Concurrent;
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.Extensions.Logging;
namespace AzureFunctionsPGPEncrypt
{
public static class PGPEncrypt
{
private static readonly HttpClient client = new HttpClient();
private static ConcurrentDictionary<string, string> secrets = new ConcurrentDictionary<string, string>();
[FunctionName(nameof(PGPEncrypt))]
public static async Task<IActionResult> RunAsync(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)]
HttpRequest req, ILogger log)
{
log.LogInformation($"C# HTTP trigger function {nameof(PGPEncrypt)} processed a request.");
string publicKeyBase64 = req.Query["public-key"];
string publicKeyEnvironmentVariable = req.Query["public-key-environment-variable"];
string publicKeySecretId = req.Query["public-key-secret-id"];
if (publicKeyBase64 == null && publicKeyEnvironmentVariable == null && publicKeySecretId == null)
{
return new BadRequestObjectResult("Please pass a base64 encoded public key, an environment variable name, or a key vault secret identifier on the query string");
}
if (publicKeyBase64 == null && publicKeyEnvironmentVariable != null)
{
publicKeyBase64 = Environment.GetEnvironmentVariable(publicKeyEnvironmentVariable);
}
if (publicKeyBase64 == null && publicKeySecretId != null)
{
try
{
publicKeyBase64 = await GetPublicKeyAsync(publicKeySecretId);
}
catch (KeyVaultErrorException e) when (e.Body.Error.Code == "SecretNotFound")
{
return new NotFoundResult();
}
catch (KeyVaultErrorException e) when (e.Body.Error.Code == "Forbidden")
{
return new UnauthorizedResult();
}
}
byte[] data = Convert.FromBase64String(publicKeyBase64);
string publicKey = Encoding.UTF8.GetString(data);
req.EnableRewind(); //Make RequestBody Stream seekable
Stream encryptedData = await EncryptAsync(req.Body, publicKey);
return new OkObjectResult(encryptedData);
}
private static async Task<string> GetPublicKeyAsync(string secretIdentifier)
{
if (!secrets.ContainsKey(secretIdentifier))
{
var azureServiceTokenProvider = new AzureServiceTokenProvider();
var authenticationCallback = new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback);
var kvClient = new KeyVaultClient(authenticationCallback, client);
SecretBundle secretBundle = await kvClient.GetSecretAsync(secretIdentifier);
secrets[secretIdentifier] = secretBundle.Value;
}
return secrets[secretIdentifier];
}
private static async Task<Stream> EncryptAsync(Stream inputStream, string publicKey)
{
using (PGP pgp = new PGP())
{
Stream outputStream = new MemoryStream();
using (inputStream)
using (Stream publicKeyStream = GenerateStreamFromString(publicKey))
{
await pgp.EncryptStreamAsync(inputStream, outputStream, publicKeyStream, true, true);
outputStream.Seek(0, SeekOrigin.Begin);
return outputStream;
}
}
}
private static Stream GenerateStreamFromString(string s)
{
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(s);
writer.Flush();
stream.Position = 0;
return stream;
}
}
}
关于azure - 如何在Azure Logicapp中加密xml文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60016666/
我正在使用自定义连接器并尝试填充动态架构响应 使用x-ms-dynamic-schema 这就是我的招摇: responses: '200': description: Res
创建了http请求触发器并列出了blob操作,然后为每个创建的获取blob内容并创建了blob操作 在输入存储帐户名称后创建 blob 时,仍然需要获取存储帐户名称作为错误消息,在此之后我想删除 bl
我正在使用自定义连接器并尝试填充动态架构响应 使用x-ms-dynamic-schema 这就是我的招摇: responses: '200': description: Res
创建了http请求触发器并列出了blob操作,然后为每个创建的获取blob内容并创建了blob操作 在输入存储帐户名称后创建 blob 时,仍然需要获取存储帐户名称作为错误消息,在此之后我想删除 bl
我已在 LogicApp 中设置了“身份”,在容器注册表中添加了必要的 AcrPull 访问权限,但无法让逻辑应用访问 Azure 中的私有(private)容器注册表(出现错误; "error":
我在 Visual Studio 2017 中创建了一个新的 Azure 资源组,并选择了逻辑应用。项目中有Deploy-AzureResourceGroup.ps1。 我想根据 LogicApp.j
我已在 LogicApp 中设置了“身份”,在容器注册表中添加了必要的 AcrPull 访问权限,但无法让逻辑应用访问 Azure 中的私有(private)容器注册表(出现错误; "error":
在logicapp的配置 Blade 中搜索Key Vault引用应用程序 Error@ Key Vault 引用无法解决 为了解决此错误,我正在logicapp中搜索配置 Blade ,但没有找到
目前我正在使用逻辑应用程序,我想使用变量将给定 DateTimeFormat 的小时数设置为 00:00:00。之后我尝试添加一个 int 变量作为小时,但这不起作用。有什么想法吗? formatDa
已解析的消息{“日期”:“2022-02-04”,“客户ID”:123,“客户信息”: {“id”:123,“姓氏”:“史密斯”,“名字”:“大卫”,“电子邮件”:“测试[email protecte
是否可以创建一个逻辑应用来监视特定虚拟机并发送有关断电/通电或 CPU 使用率百分比的电子邮件通知? 我已经阅读了事件网格,但它似乎更适合资源创建/删除通知,而不是特定的虚拟机信号。 我也知道可以在虚
我正在使用 Terraform 创建 LogicApps。逻辑应用程序将执行 Webhook,我想发布文本。 我想使用 If 语句自定义 Terraform 代码的文本字段。我希望文本的某些部分仅在产
完全重新表述问题,因为第一次尝试尚不清楚。 在我的逻辑应用程序中,我正在从 blob 读取 .json,其中包含: { "alpha": { "url": "https://l
完全重新表述问题,因为第一次尝试尚不清楚。 在我的逻辑应用程序中,我正在从 blob 读取 .json,其中包含: { "alpha": { "url": "https://l
可以使用默认的 LogicApp 连接器或 HTTP POST 方法从 LogicApp 调用 Azure Function。 我们正在使用 LogicApp 提供的默认连接器。 FunctionAp
我正在尝试配置一个已设置与 CosmosDB 连接的 LogicApp。 CosmosDB 资源已配置,但连接失败。 错误: {"status": "Failed","error": {"code":
我是新的 Azure 函数,我的任务之一是从 Sql 数据库读取数据,并使用 Azure 函数将该数据作为 csv 文件上传到 azure Blob 存储中,然后使用logicapps 检索它。我无法
我可以使用 C# SDK 检索逻辑应用程序连接器的元数据吗?我正在使用:Microsoft.Azure.Management.Logic.LogicManagementClient.Workflows
我有一个连接到 Azure 中的 SQL Server 数据库的 Azure 逻辑应用。该表有一个 uniqueidentifier 列作为主键。在逻辑应用中,删除或更新需要 rowid 才能执行更新
我正在尝试使用“向 DevOps 发送 HTTP 请求”操作自动批准来自逻辑应用的拉取请求。出现以下身份验证错误。 尝试了以下选项,但没有任何效果。 创建了具有完全访问权限的新 PAT 并传递到 he
我是一名优秀的程序员,十分优秀!