Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 374. Azure - Runbook 기능 소개 [링크 복사], [링크+제목 복사],
조회: 21498
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 2개 있습니다.)
(시리즈 글이 6개 있습니다.)
.NET Framework: 736. C# - API를 사용해 Azure에 접근하는 방법
; https://www.sysnet.pe.kr/2/0/11480

개발 환경 구성: 374. Azure - Runbook 기능 소개
; https://www.sysnet.pe.kr/2/0/11511

.NET Framework: 745. Azure runbook을 PowerShell 또는 C# 코드로 실행하는 방법
; https://www.sysnet.pe.kr/2/0/11516

.NET Framework: 746. Azure runbook 예제 - 6시간 동안 수행 중인 VM을 중지
; https://www.sysnet.pe.kr/2/0/11517

.NET Framework: 800. C# - Azure REST API 사용을 위한 인증 획득
; https://www.sysnet.pe.kr/2/0/11758

개발 환경 구성: 418. Azure - Runbook 내에서 또 다른 Runbook 스크립트를 실행
; https://www.sysnet.pe.kr/2/0/11760




Azure - Runbook 기능 소개

Azure에는 "Azure Automation"이라고도 알려진, 말 그대로 Auzre의 기능들을 자동화할 수 있는 Runbook이라는 기능이 있습니다.

Starting a runbook in Azure Automation
; https://docs.microsoft.com/en-us/azure/automation/automation-starting-a-runbook

Getting Started With Azure Automation - Runbook Management
; https://azure.microsoft.com/en-us/blog/azure-automation-runbook-management/

Runbook 기능의 구조는 대략 다음과 같습니다.

Resource Group (리소스 그룹)
    - Automation Accounts (Automation 계정)
        - Runbook

자동화 스크립트이기 때문에, 당연히 권한이 있는 사용자의 계정으로 실행해야 하는데 이를 위해 "Automation Accounts"가 필요합니다. 얼핏 보면, C# 프로그램에서 Azure를 접근하기 위해 계정이 필요했던 것과 유사합니다.

C# - API를 사용해 Azure에 접근하는 방법
; https://www.sysnet.pe.kr/2/0/11480

실제로, 자동화 스크립트(Runbook)을 실행하기 위한 계정 등록을 Azure Portal의 "Automations Accounts(Automation 계정)" 메뉴에서 할 수 있습니다. (기본적으로 보이지 않기 때문에 "All services" 메뉴를 통해 등록해야 합니다.)

일단 Account를 등록하면 해당 리소스 그룹에 다음과 같이 "Automation Accounts" 항목이 생성됩니다.

azure_runbook_1.png

선택하고 들어가면, 기본적으로 "PROCESS AUTOMATION(프로세스 자동화)" / "Runbooks" 메뉴에 다음과 같이 5개 정도의 runbook 예제가 등록된 것을 볼 수 있고 원한다면 "Add a runbook(Runbook 추가)" 버튼을 이용해 자신만의 스크립트를 등록할 수 있습니다.

azure_runbook_2.png

Workflow 형태를 비롯해 Python과 PowerShell 유형을 지원하는데 테스트를 위해 간단하게 다음과 같은 코드로만 만들고,

Write-Output "TEST"

게시한 후 실행을 하면 완료 로그에 "TEST" 글자가 찍힌 것을 확인할 수 있습니다.




작성한 Runbook은 Azure Portal을 통해 직접 실행하거나, Schedule 또는 Webhook으로 접근 가능하게 등록할 수 있습니다. Webhook의 경우 등록 순간에 다음과 같은 식의 고유 URL을 복사할 수 있도록 해주고, (이 URL은 등록 순간에만 공개되므로 보관하고 있어야 합니다.)

https://s4events.azure-automation.net/webhooks?token=1%2fkxy...[생략]...g%3d

이후 외부에서 해당 Webhook URL을 POST 방식으로 호출하면 연관된 runbook이 실행됩니다.

Starting an Azure Automation runbook with a webhook
; https://docs.microsoft.com/en-us/azure/automation/automation-webhooks

간단하게 이 경우에도 PowerShell을 이용해 다음과 같이 호출해 볼 수 있습니다.

PS > $uri = "https://s4events.azure-automation.net/webhooks?token=1%2...[생략]...%3d"
PS > $response = Invoke-RestMethod -Method Post -Uri $uri
PS > $response
JobIds
------
{f0305eeb-d799-4006-9c80-f1dbce6cccc6}




이 정도면 ^^ 대충 개념이 잡히시죠? 아래의 글을 읽어 보시면 runbook의 활용 방안을 좀 더 넓히실 수 있을 것입니다.

[VM] 수백대의 가상머신을 예약된 시간에 켜고 끄는 방법을 알아보자 ! (Automation + OMS + SendGrid)
; http://cloud.syncrofusion.com/?page_id=4&uid=217&mod=document




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 5/2/2018]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 121  122  123  124  125  126  127  128  129  130  [131]  132  133  134  135  ...
NoWriterDateCnt.TitleFile(s)
1814정성태11/18/201421527오류 유형: 263. Unable to find the requested .Net Framework Data Provider. It may not be installed.
1813정성태11/18/201423244오류 유형: 262. Build Events에 robocopy 작업이 있는 경우 "VCEnd exited with code 3" 오류 발생
1812정성태11/17/201420993.NET Framework: 482. ETW 자동 생성 코드의 VerificationException 예외 발생
1811정성태11/16/201422236.NET Framework: 481. Mono 내부의 문자열 처리 방식은 UTF-8
1810정성태11/15/201459217.NET Framework: 480. C# - 배치 파일 실행하고 출력 결과를 얻는 방법 [4]
1809정성태11/11/201424145.NET Framework: 479. Mono Profiler를 Unity의 Plugin으로 사용하는 방법
1808정성태11/11/201424416.NET Framework: 478. C# - 폴더 경로 문자열에서 "..", "." 표기를 고려한 최종 문자열을 얻는 방법 [2]
1807정성태11/10/201430785개발 환경 구성: 250. 서버용 Socket에서 사용하는 포트가 충돌한다면?파일 다운로드1
1806정성태11/10/201426587.NET Framework: 477. SeCreateGlobalPrivilege 특권과 WCF NamedPipe
1805정성태11/5/201423452.NET Framework: 476. Visual Studio에서 Mono용 Profiler 개발 [3]파일 다운로드1
1804정성태11/5/201429712.NET Framework: 475. ETW(Event Tracing for Windows)를 C#에서 사용하는 방법 [9]파일 다운로드1
1803정성태11/4/201421106오류 유형: 261. Windows Server Backup 오류 - Error in backup of E:\$Extend\$RmMetadata\$TxfLog
1802정성태11/4/201423628오류 유형: 260. 이벤트 로그 - Windows Error Reporting / AEAPPINVW8
1801정성태11/4/201428994오류 유형: 259. 이벤트 로그 - Windows Error Reporting / IPX Assertion / KorIME.exe [1]
1800정성태11/4/201419537오류 유형: 258. 이벤트 로그 - Starting a SMART disk polling operation in Automatic mode.
1799정성태11/4/201424301오류 유형: 257. 이벤트 로그 - The WMI Performance Adapter service entered the stopped state.
1798정성태11/4/201432957오류 유형: 256. 이벤트 로그 - The WinHTTP Web Proxy Auto-Discovery Service service entered the stopped state. [1]
1797정성태11/4/201418947오류 유형: 255. 이벤트 로그 - The Adobe Flash Player Update Service service entered the stopped state.
1796정성태10/30/201426009개발 환경 구성: 249. Visual Studio 2013에서 Mono 컴파일하는 방법
1795정성태10/29/201428124개발 환경 구성: 248. Lync 2013 서버 설치 방법
1794정성태10/29/201423622개발 환경 구성: 247. "Microsoft Office 365 Enterprise E3" 서비스에 대한 간략 소개
1793정성태10/27/201424388.NET Framework: 474. C# - chromiumembedded 사용 - 두 번째 이야기 [2]파일 다운로드1
1792정성태10/27/201424520.NET Framework: 473. WebClient 객체에 쿠키(Cookie)를 사용하는 방법
1791정성태10/22/201424132VC++: 83. G++ - 템플릿 클래스의 iterator 코드 사용에서 발생하는 컴파일 오류 [5]
1790정성태10/22/201419422오류 유형: 254. NETLOGON Service is paused on [... AD Server...]
1789정성태10/22/201422482오류 유형: 253. 이벤트 로그 - The client-side extension could not remove user policy settings for '...'
... 121  122  123  124  125  126  127  128  129  130  [131]  132  133  134  135  ...