Azure Automation :The Azure Automation service provides a highly reliable and scalable workflow execution engine to automate frequently repeated management tasks. The processes are automated through runbooks, which are Windows PowerShell Workflows run in the Azure Automation execution engine. You can use this API to create, update, read, and delete automation resources, including runbooks and runbook jobs. In addition you can manage assets such as variables, schedules, Windows PowerShell modules, credentials, and certificates.

Azure 自动化服务提供了一个高度可靠和可扩展的工作流执行引擎,可以自动执行频繁重复的管理任务。 这些流程通过 runbook 自动完成,这些 runbook 是在 Azure 自动化执行引擎中运行的 Windows PowerShell 工作流。 可以使用此 API 来创建、更新、读取和删除自动化资源,包括 runbook 和 runbook 作业。 此外,还可以管理诸如变量、时间表、Windows PowerShell 模块、凭据和证书等资产。

Source : https://docs.microsoft.com/en-us/rest/api/automation/

问题描述

自动化账号( Automation Account )生成的时候怎么生成连接( Connection)与证书( Certificate)?

问题回答

在中国区Azure中创建Connection时,需要修改为中国区的ARM Endpoint。比如Connection的Endpoint (终结点)应为:

https://management.chinacloudapi.cn
/subscriptions/<subscriptionid>
/resourceGroups/< resourceGroups >/providers/Microsoft.Automation
/automationAccounts/< automationAccounts name>
/connections/<connectionname>?api-version=2015-10-31

请求示例可参考:https://docs.microsoft.com/en-us/rest/api/automation/connection/create-or-update#create-or-update-connection

Sample Request

PUT https://management.chinacloudapi.cn/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts
/myAutomationAccount28/connections/mysConnection?api-version=2015-10-31

Request Body

{
"name": "mysConnection",
"properties": {
"description": "my description goes here",
"connectionType": {
"name": "Azure"
},
"fieldDefinitionValues": {
"AutomationCertificateName": "mysCertificateName",
"SubscriptionID": "subid"
}
}
}

Sample Response

  • Status code:201
{
"id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/myAutomationAccount28/connections/mysConnection",
"name": "mysConnection",
"properties": {
"creationTime": "2017-03-27T07:52:29.29+00:00",
"lastModifiedTime": "2017-03-27T07:52:29.29+00:00",
"description": "my description goes here",
"fieldDefinitionValues": {
"AutomationCertificateName": "mysCertificateName",
"SubscriptionID": "subid"
},
"connectionType": {
"name": "Azure"
}
}
}
  • Status code:200
{
"id": null,
"name": "mysConnection",
"properties": {
"creationTime": "2017-03-27T07:52:29.29+00:00",
"lastModifiedTime": "2017-03-27T07:52:29.29+00:00",
"description": "my description goes here",
"fieldDefinitionValues": {
"AutomationCertificateName": "mysCertificateName",
"SubscriptionID": "subid"
},
"connectionType": {
"name": "Azure"
}
}
}

对Automation Account创建证书,则和Connection接口相似。详情可见:https://docs.microsoft.com/en-us/rest/api/automation/certificate

而如果是指在调用REST API时,需要在Header中携带 Authorization 值。基于Azure对授权的统一管理,需要在Azure AD中对客户端(REST API调用端)进行一个身份注册,然后可以在AAD中上传证书或者是通过密钥登录。

设置密钥(Secret)非常简单:打开Azure AD页面 --> 选择所注册的Applicaiton -->  选择“Certificates & secrets” -->  "New client secret"

而设置证书方式,与密钥在同一个页面,只是上传证书需注意:要上传带有私钥的证书,不能为公钥证书。否则,会遇见“ The private key is not present in the X.509 certificate ”错误。

参考资料

Automation REST API Reference: https://docs.microsoft.com/en-us/rest/api/automation/

【Azure Developer】Azure Automation 自动化账号生成的时候怎么生成连接 与证书 (Connection & Certificate)的更多相关文章

  1. 如何在Win8.1和Win2012上运用PowerShell快速生成、安装、导出自签名证书 (Self-Signed Certificate)

    自签名证书用途很广,测试,开发,本地或者云端网站(比如Microsoft Azure Web Site)都会使用到.本文会介绍一种在Win8.1和Win2012 R2上使用PowerShell快速生成 ...

  2. 体验Azure的 Automation “自动化” 服务预览版

    一直想要实现对Azure上跑的虚机进行定期的自动备份.在网上搜了一下有关的解决方案,发现一个不错的帖子,是基于国外的Azure服务做的.基本原理就是利用Azure的Automation(自动化)服务来 ...

  3. 使用Azure Automation(自动化)定时关闭和启动虚拟机

    1. 概述 作为Windows Azure的用户,使用Azure的过程中,最担心的事情就是还没到月底,预设的费用就快消耗完了(下面两张账单图是我最讨厌看到的).但是仔细分析自己的费用列表,发现绝大部分 ...

  4. 【Azure Developer】解决Azure Key Vault管理Storage的示例代码在中国区Azure遇见的各种认证/授权问题 - C# Example Code

    问题描述 使用Azure密钥保管库(Key Vault)来托管存储账号(Storage Account)密钥的示例中,从Github中下载的示例代码在中国区Azure运行时候会遇见各种认证和授权问题, ...

  5. 【Azure Developer】使用Microsoft Graph API 批量创建用户,先后遇见的三个错误及解决办法

    问题描述 在先前的一篇博文中,介绍了如何使用Microsoft Graph API来创建Azure AD用户(博文参考:[Azure Developer]使用Microsoft Graph API 如 ...

  6. 【Azure Developer】Github Action部署资源(ARM模板)到Azure中国区时,遇见登录问题的解决办法

    问题描述 在参考文档"使用 GitHub Actions 部署 ARM 模板"一文中,由于是在中国区Azure上操作,所以生产的部署凭证为中国区凭证.当创建工作流时,在登录到Azu ...

  7. 【Azure Developer】【Python 】使用 azure.identity 和 azure.common.credentials 获取Azure AD的Access Token的两种方式

    问题描述 使用Python代码,展示如何从Azure AD 中获取目标资源的 Access Token. 如要了解如何从AAD中获取 client id,client secret,tenant id ...

  8. 【Azure Developer】使用 Microsoft Authentication Libraries (MSAL) 如何来获取Token呢 (通过用户名和密码方式获取Access Token)

    问题描述 在上一篇博文<[Azure Developer]使用 adal4j(Azure Active Directory authentication library for Java)如何来 ...

  9. 【Azure Developer】调用SDK的runPowerShellScript方法,在Azure VM中执行PowerShell脚本示例

    当需要通过代码的方式执行PowerShell脚本时,可以参考以下的示例. Azure SDK中提供了两个方法来执行PowerShell脚本 (SDK Source Code: https://gith ...

随机推荐

  1. ffmpeg细节整理记录

    ffmpeg细节整理记录 1.-vcodec.-code:v.-c:v ffmpeg的官方文档 -vcodec 是 -code:v 别名. -vcodec codec (output) Set the ...

  2. linux(4)----------ssh config详解

    1.概述 ~~  config为了方便我们批量管理多个ssh ~~  config存放在~/.ssh/config                 .XX代表隐藏目录 ~~  config配置语法 2 ...

  3. Vue.JS快速上手(指令和实例方法)

    1.声明式渲染 首先,我们要知道Vue是声明式渲染,那啥是声明式渲染,我们只需要告诉程序我们想要什么结果,其他的交给程序来做.与声明式渲染相对的是命令式渲染,即命令我们的程序去做什么,程序就会跟着你的 ...

  4. T-SQL - 习题01_查询每门课都大于80分的学生姓名

    时间:2017-09-11 整理:byzqy 题目:用一条SQL语句查询出每门课都大于80分的学生姓名. 最近面试C#开发工程师,碰到上面这个考数据库的题目,自己感觉有点难度,没有思路,现将找到的解决 ...

  5. IMO 1977 第 2 题探析

    原题:在一个有限的实数数列中,任意 7 个连续项之和为负数,且任意 11 个连续项之和为正数.求这个数列最多有多少项. 解法一:记这个数列为 a1, a2, ..., ak,问题等价于求 k 的最大值 ...

  6. eclipse建立c语言工程以及成功下载到FPGA芯片过程遇到的各种问题以及解决方法详解

    推荐大家预先建立好一个工程目录文件夹,确实挺好用,参考正点原子的pdf教程,如下图所示, 我们eclipse在software文件夹建立一个workspace即可 选择用helloworld模板建立工 ...

  7. Identity用户管理入门六(判断是否登录)

    目前用户管理的增删改查及登录功能已经全部实现,但存在一个问题,登录后要取消登录按钮显示退出按钮,未登录应该有注册按钮,现实现过程如下 一.Startup.cs中增加服务 app.UseAuthenti ...

  8. Windows中nginx多次启动的问题

    在Windows上做开发环境中的nginx服务器.为了使nginx在后台运行,使用如下命令来启停nginx: cd <nginx安装目录> # 开启nginx并在后台运行 start ng ...

  9. Dart简易教程 (1)---数据类型 运算符,类转换换

    从下面开始学习DART编程 以下是一个简单的示例: main(){ var number = 42; print(number);}程序说明,dart是一个强大的脚本类语言,可以不预先定义变量类型 , ...

  10. ☕【Java技术指南】「并发编程专题」针对于Guava RateLimiter限流器的入门到精通(含实战开发技巧)

    并发编程的三剑客 在开发高并发系统时有三剑客:缓存.降级和限流. 缓存 缓存的目的是提升系统访问速度和增大系统处理容量. 降级 降级是当服务出现问题或者影响到核心流程时,需要暂时屏蔽掉,待高峰或者问题 ...