我领导着一个庞大的 azure 函数开发团队。因此,Microsoft 引用的大多数使用 azure Web 界面的示例对我都不起作用。我正在使用模拟器在本地开发 Azure 函数以节省一些成本。我通过 Visual Studio 将所有功能发布到我的集成环境中。
我正在开发一堆需要 api 网关来处理使用 Azure AD B2C 的身份验证工作流的 azure 函数。现在,没有可以在本地运行的 api 网关模拟器或 Azure AD B2C 模拟器。我的身份验证工作流程涉及拦截对 api 的请求,将它们重定向到 AD B2C 进行身份验证,随后将 auth-token 添加到 http 标头,然后调用 http 触发的 azure 函数。
现在,问题变成了,我如何测试身份验证工作流程?如何设置 api 网关以将我在 Visual Studio 中本地运行的函数注册为云中 api 网关的 api 端点?
restful-authentication azure azure-api-management azure-ad-b2c azure-functions
我在 spring 云网关中遇到了一个非常奇特的问题。每个备用请求都会返回 404。这发生在我在 api-gateway 中配置的所有服务中,无一例外。我什至不知道从哪里开始调试这个问题。
这是我用于通用配置的 application.yml 文件。
server:
port: 8080
ssl:
enabled: true
key-store: classpath:keystore.p12
key-store-password: password
key-store-type: pkcs12
key-alias: tomcat
security:
require-ssl=true:
logging:
level:
org:
springframework:
cloud.gateway: DEBUG
http.server.reactive: DEBUG
web.reactive: DEBUG
spring:
application:
name: api-gateway
cloud:
gateway:
httpclient:
ssl:
useInsecureTrustManager: true
Run Code Online (Sandbox Code Playgroud)
这是我的java配置文件
@EnableWebFluxSecurity
public class SecurityConfig {
@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http,
ReactiveClientRegistrationRepository clientRegistrationRepository) {
// Authenticate through configured OpenID Provider
http.oauth2Login();
// Also logout at the OpenID Connect provider
http.logout(logout -> logout.logoutSuccessHandler(new OidcClientInitiatedServerLogoutSuccessHandler(
clientRegistrationRepository)));
// …Run Code Online (Sandbox Code Playgroud) 我有一个集合,我插入不同类型的文档.我使用type参数来区分集合中的不同数据类型.当我插入文档时,我为每个文档创建了一个Id字段,但Cosmosdb有一个内置的id字段.
如何在一个查询中插入新文档并检索所创建文档的ID?
建立 SQL 连接既昂贵又缓慢,因此我们在 3 层应用程序中使用连接池等概念。
当使用访问 SQL 数据库的 Azure 函数时,我们必须连接到数据库,然后执行我们的逻辑。这不会使 azure 功能变得很慢吗?这不会通过过度使用连接来降低数据库性能吗?
有没有办法在 Azure 函数中使用可重用的连接池?
sql-server database-connection azure-functions connection-pool
这是我的函数代码。
#r "Microsoft.WindowsAzure.Storage.Blob"
public static async Task Run(CloudBlockBlob uploadedVideo, string name, CloudBlockBlob processedVideo, ILogger log)
{
log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {uploadedVideo.Length} Bytes");
var fileEntry = new
{
fileName = $"uploaded-videos/{name}",
fileType = "video",
correlationId = Guid.NewGuid()
};
await processedVideo.StartCopyAsync(uploadedVideo);
await uploadedVideo.DeleteIfExistsAsync();
}
Run Code Online (Sandbox Code Playgroud)
这是我的 function.json
{
"bindings": [
{
"name": "uploadedVideo",
"type": "blobTrigger",
"direction": "in",
"path": "uploaded-videos/{name}",
"connection": "AzureWebJobsStorage"
},
{
"type": "blob",
"name": "processedVideo",
"path": "processed-videos/{name}-{rand-guid}",
"connection": "AzureWebJobsStorage",
"direction": "out"
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是我运行此函数时不断抛出的错误。
2018-09-25T07:34:10.813 …
我正在尝试开发一个 azure 函数,该函数触发集合中的插入/更新。从 azure webjobs sdk 文档中,我最好的选择是 CosmosDBTrigger 函数。但是,当我使用 Visual Studio“azure 函数”扩展创建 CosmosDBTrigger 函数时出现编译错误。看起来 CosmosDBTrigger 的 vsix 没有自动包含 CosmosDBTrigger 类的 nuget 包引用。
有没有人使用 Visual Studio 2017 创建从 ChangeFeed 项触发的 azure 函数?
更新:当我尝试引入 Microsoft.Azure.Webjobs.Extensions 时,出现以下错误。
NU1608: Detected package version outside of dependency constraint: Microsoft.NET.Sdk.Functions 1.0.11 requires Microsoft.Azure.WebJobs.Extensions (= 2.1.0) but version Microsoft.Azure.WebJobs.Extensions 3.0.0-beta5 was resolved.
NU1107: Version conflict detected for Microsoft.Azure.WebJobs. Reference the package directly from the project to resolve this issue.
Accelerator.Feed Microsoft.Azure.WebJobs.Extensions 3.0.0-beta5 -> Microsoft.Azure.WebJobs (>= 3.0.0-beta5)
Accelerator.Feed …Run Code Online (Sandbox Code Playgroud) database visual-studio azure-functions visual-studio-2017 azure-cosmosdb
我在 Ubuntu 18.04.2 上使用 snap 安装了 docker。
当我尝试启动 docker 时,它失败并显示以下错误日志。
2020-07-16T23:49:14Z docker.dockerd[932]: failed to start containerd: timeout waiting for containerd to start
2020-07-16T23:49:14Z systemd[1]: snap.docker.dockerd.service: Main process exited, code=exited, status=1/FAILURE
2020-07-16T23:49:14Z systemd[1]: snap.docker.dockerd.service: Failed with result 'exit-code'.
2020-07-16T23:49:14Z systemd[1]: snap.docker.dockerd.service: Service hold-off time over, scheduling restart.
2020-07-16T23:49:14Z systemd[1]: snap.docker.dockerd.service: Scheduled restart job, restart counter is at 68.
2020-07-16T23:49:14Z systemd[1]: Stopped Service for snap application docker.dockerd.
2020-07-16T23:49:14Z systemd[1]: Started Service for snap application docker.dockerd.
Run Code Online (Sandbox Code Playgroud)
它一遍又一遍地进入重新启动循环。我应该怎么做才能让 docker 重新工作?
azure ×3
api-gateway ×1
azure-ad-b2c ×1
c# ×1
database ×1
docker ×1
entity ×1
hsqldb ×1
primary-key ×1
spring-boot ×1
spring-cloud ×1
sql-server ×1
ubuntu ×1