当前位置: 首页 > news >正文

Using Azure openAI key rotation automation

题意:使用 Azure OpenAI 密钥轮换自动化

问题背景:

We are planning to do the Azure OpenAI key rotation automatically. How can we achieve this? Do we have terraform resource for this.

我们计划自动执行 Azure OpenAI 密钥轮换。我们如何实现这一点?是否有相应的 Terraform 资源可用?

resource "azurerm_cognitive_account" "example" {name                = "xxxxx"location            = azurerm_resource_group.example.locationresource_group_name = azurerm_resource_group.example.namekind                = "OpenAI"sku_name = "S0"
}

问题解决:

Firstly, there is no direct resource present for the Open AI key rotation in terraform. Following a workaround on the requirement, I found below approach to make it work.

首先,Terraform 中没有直接用于 OpenAI 密钥轮换的资源。针对这一需求,我找到了一种可行的替代方法,具体如下。

As I mentioned in the comments, use azurerm_cognitive_account resource from terraform by providing kind as an "OpenAI" as shown.

正如我在评论中提到的,可以使用 Terraform 中的 azurerm_cognitive_account 资源,并将 kind 设置为 OpenAI,如图所示。

I tried creating a new open AI account with the below code and the deployment was successful.

我尝试使用以下代码创建一个新的 OpenAI 帐户,部署成功。

provider  "azurerm"{features{}
}
data  "azurerm_resource_group"  "example"  {name = "DefaultResourceGroup-EUS"
}
resource  "azurerm_cognitive_account"  "example"  {name = "examplesample"location = data.azurerm_resource_group.example.locationresource_group_name = data.azurerm_resource_group.example.namekind = "OpenAI"
sku_name = "S0"
}
}

Once it is done, you need to retrieve the keys from the external path. To do that, use data "external" block.

完成后,你需要从外部路径检索密钥。为此,可以使用 data "external" 块。

How to use it: Reference

Sample data block shown below:

示例数据块如下所示:

data "external" "keys" {program = ["sh", "/path/retrieve_sshkey.sh"]
}

Now refer this in the main.tf terraform resource with null_resource block by passing the open ai resource id under triggers block and add a provisioner as well.

现在,在 main.tf Terraform 资源中,通过在 null_resource 块的 triggers 块中传递 OpenAI 资源 ID,并添加一个 provisioner

resource "null_resource" "samplerotation" {triggers = {open_ai_resource_id = azurerm_cognitive_account.example.id}
provisioner "remote-exec" {//write a powershell script here and refer the above keys data block here}
}

Alternatively, you can also follow an other approach with the help of key vault. Store all the keys in the key vault and apply the key rotation from there itself.

另外,你也可以使用密钥保管库(Key Vault)采取另一种方法。将所有密钥存储在密钥保管库中,并从那里执行密钥轮换。

To do so, refer the terraform code from SO & for CLI approach refer Github doc.

为此,可以参考来自 Stack Overflow 的 Terraform 代码,并且对于 CLI 方法,可以参考 GitHub 文档。

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 大数据毕业设计开题报告100例
  • Kafka快速入门:Kafka驱动JavaApi的使用
  • docker容器数据卷、数据卷基本案例
  • WebSocket、Socket和Netty的关系
  • Ubuntu下torch.cuda.is_available() 返回 False情况
  • 2-75 基于matlab的多尺度小波核svm预测
  • 谷歌浏览器 Google Chrome 禁止扩展.crx更新
  • 二叉树【2.5】代码专项
  • 合宙LuatOS开发板使用说明——Air700ECQ
  • Jenkins:自动化的魔法师,打造无缝CI/CD流水线
  • 企业级WEB应用服务器TOMCAT——超详细攻略
  • spring揭秘10-aop04-基于AspectJ类库注解织入横切逻辑
  • 中科服务器磁盘未断电状态被人拔插导致raid故障,安装系统找不到系统盘 修复raid再次安装系统成功
  • 【第78课】数据库安全RedisCouchDBH2database未授权访问CVE漏洞
  • [数据集][目标检测]红外场景下车辆和行人检测数据集VOC+YOLO格式19069张4类别
  • 【391天】每日项目总结系列128(2018.03.03)
  • Electron入门介绍
  • Javascripit类型转换比较那点事儿,双等号(==)
  • mysql 5.6 原生Online DDL解析
  • PHP 程序员也能做的 Java 开发 30分钟使用 netty 轻松打造一个高性能 websocket 服务...
  • PyCharm搭建GO开发环境(GO语言学习第1课)
  • Terraform入门 - 1. 安装Terraform
  • vue 配置sass、scss全局变量
  • 从零开始的无人驾驶 1
  • 解析 Webpack中import、require、按需加载的执行过程
  • 你真的知道 == 和 equals 的区别吗?
  • 什么软件可以提取视频中的音频制作成手机铃声
  • 写给高年级小学生看的《Bash 指南》
  • 怎么将电脑中的声音录制成WAV格式
  • ​【原创】基于SSM的酒店预约管理系统(酒店管理系统毕业设计)
  • ​软考-高级-信息系统项目管理师教程 第四版【第14章-项目沟通管理-思维导图】​
  • ​水经微图Web1.5.0版即将上线
  • ​学习笔记——动态路由——IS-IS中间系统到中间系统(报文/TLV)​
  • # wps必须要登录激活才能使用吗?
  • #我与Java虚拟机的故事#连载01:人在JVM,身不由己
  • (04)odoo视图操作
  • (14)Hive调优——合并小文件
  • (day6) 319. 灯泡开关
  • (二)WCF的Binding模型
  • (附源码)springboot 校园学生兼职系统 毕业设计 742122
  • (附源码)ssm经济信息门户网站 毕业设计 141634
  • (函数)颠倒字符串顺序(C语言)
  • (十八)三元表达式和列表解析
  • (十一)JAVA springboot ssm b2b2c多用户商城系统源码:服务网关Zuul高级篇
  • (转)Android学习笔记 --- android任务栈和启动模式
  • .Net 6.0--通用帮助类--FileHelper
  • .NET Core 实现 Redis 批量查询指定格式的Key
  • .Net Web窗口页属性
  • .net 怎么循环得到数组里的值_关于js数组
  • .net 桌面开发 运行一阵子就自动关闭_聊城旋转门家用价格大约是多少,全自动旋转门,期待合作...
  • .NET中分布式服务
  • [20161214]如何确定dbid.txt
  • [AIGC] 广度优先搜索(Breadth-First Search,BFS)详解
  • [ASP]青辰网络考试管理系统NES X3.5
  • [Avalon] Avalon中的Conditional Formatting.