Azure API 작업은 모든 Azure REST API 직접 호출할 수 있도록 하는 범용 실행기입니다. 이 기능을 사용하면 각 Azure 작업에 대해 별도의 작업을 수행할 필요 없이 Azure 서비스와 유연하게 통합할 수 있습니다.
Azure API 실행
이 작업을 사용하면 Azure REST API 참조 에 설명된 모든 작업을 실행할 수 있습니다. API 경로, HTTP 메서드 및 요청 본문만 제공하면 해당 액션이 인증을 처리하고 시간이 오래 걸리는 작업을 자동으로 관리합니다.
입력 필드 | 선택성 | 유형 | 설명 |
|---|---|---|---|
클라이언트ID | 필수의 | 문자열 | 비밀로 유지해야 합니다. Azure 서비스 주체 클라이언트 ID입니다. |
클라이언트 시크릿 | 필수의 | 문자열 | 비밀로 유지해야 합니다. Azure 서비스 주체 클라이언트 시크릿입니다. |
세입자 ID | 필수의 | 문자열 | Azure 테넌트 식별자는 비밀 키로 전달될 수 있습니다. |
urlPath | 필수의 | 문자열 | 에 대한 URL 경로입니다. |
방법 | 필수의 | 문자열 | [
] 중 하나 |
몸 | 선택 과목 | 지도 | 필요에 따라 전달할 JSON 맵 형식의 선택적 본문으로, 일반적으로
,
및
메서드와 함께 사용됩니다. 비밀 참조는 허용됩니다. |
출력 필드 | 유형 | 설명 |
|---|---|---|
성공 | 부울 |
|
오류 메시지 | 문자열 | 실패 이유를 메시지로 전달합니다. |
response | 물체 |
각 API는 서로 다른 응답을 보여줍니다. 예를 들어 사용량 목록 - REST API(Azure 가상 네트워크)를참조하십시오. |
asyncResponseUrl | 문자열 | 장시간 작동 시 선택 사항입니다. 상태를 확인할 URL입니다. |
최종응답URL | 문자열 | 장시간 작동 시 선택 사항입니다. 이 URL은 작업이 완료되면 최종 결과를 반환합니다. |
재시도 후 초 | 정수 | 장시간 작동 시 선택 사항입니다. 비동기 URL을 폴링하기 전에 얼마나 기다려야 할까요? |
이태그 | 문자열 | 선택 과목. 리소스를 업데이트할 때 다른 사용자의 변경 사항을 덮어쓰지 않도록 동시성 제어에 사용됩니다. |
예시: 네트워크 사용량 GET
- name: getNetworkUsage type: action action: azure.execute.api version: 1 inputs: clientId: ${{ :secrets:my-client-id }} clientSecret: ${{ :secrets:my-client-secret }} tenantId: ${{ :secrets:my-tenant-id }} urlPath: "subscriptions/c6f367b2-d6af-41f5-a9e3-3828fbd97241/providers/Microsoft.Network/locations/westus/usages?api-version=2025-03-01" method: "GET" selectors: - name: firstResponseValue expression: ".response.value[0] | tostring"예시: 리소스 그룹 생성
- name: createResourceGroup type: action action: azure.execute.api version: 1 inputs: clientId: ${{ :secrets:my-client-id }} clientSecret: ${{ :secrets:my-client-secret }} tenantId: ${{ :secrets:my-tenant-id }} urlPath: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourcegroups/${{ .workflowInputs.resourceGroupName }}?api-version=2021-04-01" method: "PUT" body: location: ${{ .workflowInputs.location }} tags: environment: test createdBy: my-demo예시: 리소스 그룹 및 VM 생성 완료
name: azure-execute-api-create-vm
workflowInputs: clientId: type: String defaultValue: "${{ :secrets:my-client-id }}" clientSecret: type: String defaultValue: "${{ :secrets:my-client-secret }}" tenantId: type: String defaultValue: "${{ :secrets:my-tenant-id }}" subscriptionId: type: String resourceGroupName: type: String location: type: String defaultValue: "eastus2" vnetName: type: String defaultValue: "test-vnet" subnetName: type: String defaultValue: "test-subnet" nsgName: type: String defaultValue: "test-nsg" publicIpName: type: String defaultValue: "test-public-ip" nicName: type: String defaultValue: "test-nic" vmName: type: String defaultValue: "my-demo-vm" adminUsername: type: String defaultValue: "azureuser" sshPublicKey: type: String defaultValue: "${{ :secrets:my-ssh-public-key }}"
steps: # Step 1: Create Resource Group - name: createResourceGroup type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourcegroups/${{ .workflowInputs.resourceGroupName }}?api-version=2021-04-01" method: "PUT" body: location: ${{ .workflowInputs.location }} tags: environment: test createdBy: my-demo next: checkResourceGroupAsync
- name: checkResourceGroupAsync type: switch switch: - condition: ${{ (.steps.createResourceGroup.outputs.asyncResponseUrl // .steps.createResourceGroup.outputs.finalResponseUrl // "") != "" }} next: waitBeforePollResourceGroup next: createVirtualNetwork
- name: waitBeforePollResourceGroup type: wait seconds: ${{ .steps.createResourceGroup.outputs.retryAfterSeconds // 5 }} next: pollResourceGroup
- name: pollResourceGroup type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: ${{ .steps.createResourceGroup.outputs.asyncResponseUrl // .steps.createResourceGroup.outputs.finalResponseUrl }} method: "GET" next: checkResourceGroupStatus
- name: checkResourceGroupStatus type: switch switch: - condition: ${{ .steps.pollResourceGroup.outputs.response.status == "Succeeded" }} next: createVirtualNetwork - condition: ${{ .steps.pollResourceGroup.outputs.response.status == "Failed" }} next: logResult next: waitBeforePollResourceGroup
# Step 2: Create Virtual Network - name: createVirtualNetwork type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Network/virtualNetworks/${{ .workflowInputs.vnetName }}?api-version=2023-09-01" method: "PUT" body: location: ${{ .workflowInputs.location }} properties: addressSpace: addressPrefixes: - "10.0.0.0/24" next: checkVirtualNetworkAsync
- name: checkVirtualNetworkAsync type: switch switch: - condition: ${{ (.steps.createVirtualNetwork.outputs.asyncResponseUrl // .steps.createVirtualNetwork.outputs.finalResponseUrl // "") != "" }} next: waitBeforePollVirtualNetwork next: createSubnet
- name: waitBeforePollVirtualNetwork type: wait seconds: ${{ .steps.createVirtualNetwork.outputs.retryAfterSeconds // 5 }} next: pollVirtualNetwork
- name: pollVirtualNetwork type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: ${{ .steps.createVirtualNetwork.outputs.asyncResponseUrl // .steps.createVirtualNetwork.outputs.finalResponseUrl }} method: "GET" next: checkVirtualNetworkStatus
- name: checkVirtualNetworkStatus type: switch switch: - condition: ${{ .steps.pollVirtualNetwork.outputs.response.status == "Succeeded" }} next: createSubnet - condition: ${{ .steps.pollVirtualNetwork.outputs.response.status == "Failed" }} next: logResult next: waitBeforePollVirtualNetwork
# Step 3: Create Subnet - name: createSubnet type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Network/virtualNetworks/${{ .workflowInputs.vnetName }}/subnets/${{ .workflowInputs.subnetName }}?api-version=2023-09-01" method: "PUT" body: properties: addressPrefix: "10.0.0.0/28" next: checkSubnetAsync
- name: checkSubnetAsync type: switch switch: - condition: ${{ (.steps.createSubnet.outputs.asyncResponseUrl // .steps.createSubnet.outputs.finalResponseUrl // "") != "" }} next: waitBeforePollSubnet next: createNetworkSecurityGroup
- name: waitBeforePollSubnet type: wait seconds: ${{ .steps.createSubnet.outputs.retryAfterSeconds // 5 }} next: pollSubnet
- name: pollSubnet type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: ${{ .steps.createSubnet.outputs.asyncResponseUrl // .steps.createSubnet.outputs.finalResponseUrl }} method: "GET" next: checkSubnetStatus
- name: checkSubnetStatus type: switch switch: - condition: ${{ .steps.pollSubnet.outputs.response.status == "Succeeded" }} next: createNetworkSecurityGroup - condition: ${{ .steps.pollSubnet.outputs.response.status == "Failed" }} next: logResult next: waitBeforePollSubnet
# Step 4: Create Network Security Group with SSH access - name: createNetworkSecurityGroup type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Network/networkSecurityGroups/${{ .workflowInputs.nsgName }}?api-version=2023-09-01" method: "PUT" body: location: ${{ .workflowInputs.location }} properties: securityRules: - name: "Allow-SSH" properties: protocol: "Tcp" sourcePortRange: "*" destinationPortRange: "22" sourceAddressPrefix: "*" destinationAddressPrefix: "*" access: "Allow" priority: 100 direction: "Inbound" tags: environment: test createdBy: my-demo next: checkNetworkSecurityGroupAsync
- name: checkNetworkSecurityGroupAsync type: switch switch: - condition: ${{ (.steps.createNetworkSecurityGroup.outputs.asyncResponseUrl // .steps.createNetworkSecurityGroup.outputs.finalResponseUrl // "") != "" }} next: waitBeforePollNetworkSecurityGroup next: createPublicIP
- name: waitBeforePollNetworkSecurityGroup type: wait seconds: ${{ .steps.createNetworkSecurityGroup.outputs.retryAfterSeconds // 5 }} next: pollNetworkSecurityGroup
- name: pollNetworkSecurityGroup type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: ${{ .steps.createNetworkSecurityGroup.outputs.asyncResponseUrl // .steps.createNetworkSecurityGroup.outputs.finalResponseUrl }} method: "GET" next: checkNetworkSecurityGroupStatus
- name: checkNetworkSecurityGroupStatus type: switch switch: - condition: ${{ .steps.pollNetworkSecurityGroup.outputs.response.status == "Succeeded" }} next: createPublicIP - condition: ${{ .steps.pollNetworkSecurityGroup.outputs.response.status == "Failed" }} next: logResult next: waitBeforePollNetworkSecurityGroup
# Step 5: Create Public IP Address - name: createPublicIP type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Network/publicIPAddresses/${{ .workflowInputs.publicIpName }}?api-version=2023-09-01" method: "PUT" body: location: ${{ .workflowInputs.location }} sku: name: "Standard" properties: publicIPAllocationMethod: "Static" publicIPAddressVersion: "IPv4" tags: environment: test createdBy: my-demo next: checkPublicIPAsync
- name: checkPublicIPAsync type: switch switch: - condition: ${{ (.steps.createPublicIP.outputs.asyncResponseUrl // .steps.createPublicIP.outputs.finalResponseUrl // "") != "" }} next: waitBeforePollPublicIP next: createNetworkInterface
- name: waitBeforePollPublicIP type: wait seconds: ${{ .steps.createPublicIP.outputs.retryAfterSeconds // 5 }} next: pollPublicIP
- name: pollPublicIP type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: ${{ .steps.createPublicIP.outputs.asyncResponseUrl // .steps.createPublicIP.outputs.finalResponseUrl }} method: "GET" next: checkPublicIPStatus
- name: checkPublicIPStatus type: switch switch: - condition: ${{ .steps.pollPublicIP.outputs.response.status == "Succeeded" }} next: createNetworkInterface - condition: ${{ .steps.pollPublicIP.outputs.response.status == "Failed" }} next: logResult next: waitBeforePollPublicIP
# Step 6: Create Network Interface with Public IP and NSG - name: createNetworkInterface type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Network/networkInterfaces/${{ .workflowInputs.nicName }}?api-version=2023-09-01" method: "PUT" body: location: ${{ .workflowInputs.location }} properties: networkSecurityGroup: id: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Network/networkSecurityGroups/${{ .workflowInputs.nsgName }}" ipConfigurations: - name: "${{ .workflowInputs.nicName }}-ipconfig1" properties: privateIPAllocationMethod: "Dynamic" subnet: id: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Network/virtualNetworks/${{ .workflowInputs.vnetName }}/subnets/${{ .workflowInputs.subnetName }}" publicIPAddress: id: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Network/publicIPAddresses/${{ .workflowInputs.publicIpName }}" next: checkNetworkInterfaceAsync
- name: checkNetworkInterfaceAsync type: switch switch: - condition: ${{ (.steps.createNetworkInterface.outputs.asyncResponseUrl // .steps.createNetworkInterface.outputs.finalResponseUrl // "") != "" }} next: waitBeforePollNetworkInterface next: createVirtualMachine
- name: waitBeforePollNetworkInterface type: wait seconds: ${{ .steps.createNetworkInterface.outputs.retryAfterSeconds // 5 }} next: pollNetworkInterface
- name: pollNetworkInterface type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: ${{ .steps.createNetworkInterface.outputs.asyncResponseUrl // .steps.createNetworkInterface.outputs.finalResponseUrl }} method: "GET" next: checkNetworkInterfaceStatus
- name: checkNetworkInterfaceStatus type: switch switch: - condition: ${{ .steps.pollNetworkInterface.outputs.response.status == "Succeeded" }} next: createVirtualMachine - condition: ${{ .steps.pollNetworkInterface.outputs.response.status == "Failed" }} next: logResult next: waitBeforePollNetworkInterface
# Step 7: Create Virtual Machine - name: createVirtualMachine type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Compute/virtualMachines/${{ .workflowInputs.vmName }}?api-version=2023-09-01" method: "PUT" body: location: ${{ .workflowInputs.location }} properties: hardwareProfile: vmSize: "Standard_B2ts_v2" storageProfile: imageReference: publisher: "Canonical" offer: "0001-com-ubuntu-server-jammy" sku: "22_04-lts-gen2" version: "latest" osDisk: name: "${{ .workflowInputs.vmName }}-osdisk" createOption: "FromImage" managedDisk: storageAccountType: "Standard_LRS" diskSizeGB: 30 osProfile: computerName: ${{ .workflowInputs.vmName }} adminUsername: ${{ .workflowInputs.adminUsername }} linuxConfiguration: disablePasswordAuthentication: true ssh: publicKeys: - path: "/home/${{ .workflowInputs.adminUsername }}/.ssh/authorized_keys" keyData: ${{ .workflowInputs.sshPublicKey }} networkProfile: networkInterfaces: - id: "/subscriptions/${{ .workflowInputs.subscriptionId }}/resourceGroups/${{ .workflowInputs.resourceGroupName }}/providers/Microsoft.Network/networkInterfaces/${{ .workflowInputs.nicName }}" properties: primary: true tags: environment: test createdBy: my-demo next: checkVirtualMachineAsync
- name: checkVirtualMachineAsync type: switch switch: - condition: ${{ (.steps.createVirtualMachine.outputs.asyncResponseUrl // .steps.createVirtualMachine.outputs.finalResponseUrl // "") != "" }} next: waitBeforePollVirtualMachine next: logResult
- name: waitBeforePollVirtualMachine type: wait seconds: ${{ .steps.createVirtualMachine.outputs.retryAfterSeconds // 5 }} next: pollVirtualMachine
- name: pollVirtualMachine type: action action: azure.execute.api version: 1 inputs: clientId: ${{ .workflowInputs.clientId }} clientSecret: ${{ .workflowInputs.clientSecret }} tenantId: ${{ .workflowInputs.tenantId }} urlPath: ${{ .steps.createVirtualMachine.outputs.asyncResponseUrl // .steps.createVirtualMachine.outputs.finalResponseUrl }} method: "GET" next: checkVirtualMachineStatus
- name: checkVirtualMachineStatus type: switch switch: - condition: ${{ .steps.pollVirtualMachine.outputs.response.status == "Succeeded" }} next: logResult - condition: ${{ .steps.pollVirtualMachine.outputs.response.status == "Failed" }} next: logResult next: waitBeforePollVirtualMachine
# Step 8: Log Results - name: logResult type: action action: newrelic.ingest.sendLogs version: 1 inputs: logs: - message: "Azure VM Creation Complete" attributes: resourceGroupSuccess: ${{ .steps.createResourceGroup.outputs.success }} vnetSuccess: ${{ .steps.createVirtualNetwork.outputs.success }} subnetSuccess: ${{ .steps.createSubnet.outputs.success }} nsgSuccess: ${{ .steps.createNetworkSecurityGroup.outputs.success }} publicIpSuccess: ${{ .steps.createPublicIP.outputs.success }} nicSuccess: ${{ .steps.createNetworkInterface.outputs.success }} vmSuccess: ${{ .steps.createVirtualMachine.outputs.success }} resourceGroupName: ${{ .workflowInputs.resourceGroupName }} vmName: ${{ .workflowInputs.vmName }} location: ${{ .workflowInputs.location }} vmSize: ${{ .steps.createVirtualMachine.outputs.response.properties.hardwareProfile.vmSize // "N/A" }} provisioningState: ${{ .steps.createVirtualMachine.outputs.response.properties.provisioningState // "N/A" }} vmTags: ${{ .steps.createVirtualMachine.outputs.response.tags // {} | tostring }}