在本地开发Azure功能 [英] Developing Azure functions locally

查看:83
本文介绍了在本地开发Azure功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我领导着一支由天蓝色函数开发人员组成的大型团队.因此,Microsoft使用azure Web界面引用的大多数示例都不适合我.我正在使用模拟器在本地开发Azure函数,以节省一些成本.我通过Visual Studio将所有功能发布到我的集成环境中.

I am leading a large team of azure functions developers. So, most of the examples quoted by Microsoft using the azure web interface don't work for me. I am developing Azure functions locally using emulators to save some costs. I publish all my functions through visual studio into my integration environment.

我正在开发许多azure函数,这些函数需要api网关才能使用Azure AD B2C处理身份验证工作流.现在,没有可以在本地运行的api网关模拟器或Azure AD B2C模拟器.我的身份验证工作流程涉及拦截对api的请求,将请求重定向到AD B2C进行身份验证,然后将auth令牌添加到http标头中,然后调用http触发的azure函数.

I am developing a bunch of azure functions that need the api gateway to handle the authentication workflows using Azure AD B2C. Now, there's no api gateway emulator or an Azure AD B2C emulator that I can run locally. My authentication workflows involve intercepting requests to the api, redirecting them to AD B2C for authentication and the subsequent addition of the auth-token to the http header and then invoking the http-triggered azure functions.

现在,问题变成了,如何测试身份验证工作流程? 如何设置api网关以将我在Visual Studio中本地运行的功能注册为云中api网关的api端点?

Now, the question becomes, how do I test authentication workflows? How can I setup the api gateway to register my functions running locally in visual studio as api endpoint for my api gateway in the cloud?

推荐答案

我做了什么:

  1. 添加了一个授权" API,用于处理针对外国当局的通用授权.该API返回我自己的JWT和我自己的自定义声明,这些声明会持续有限的时间.
  2. 已将所有其他API更改为使用自定义JWT.

优势:

  • 超级容易在本地测试.我只是将#if DEBUG部分添加到授权API中,以跳过常规授权,并给我设计的JWT.
  • 我可以在索赔中放入任何内容,因此可以将其用作减少外部授权调用的缓存.

这篇关于在本地开发Azure功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆