Hybrid Runbook Worker Group - List By Automation Account
Reference
Service:
Automation
API Version:
2022-02-22
Retrieve a list of hybrid runbook worker groups.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups?api-version=2022-02-22
With optional parameters:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups?$filter={$filter}&api-version=2022-02-22
URI Parameters
Name
In
Required
Type
Description
automationAccountName
path
True
string
The name of the automation account.
resourceGroupName
path
True
string
Name of an Azure Resource group.
Regex pattern: ^[-\w\._]+$
subscriptionId
path
True
string
Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/testaccount/hybridRunbookWorkerGroups?api-version=2022-02-22
import com.azure.core.util.Context;
/** Samples for HybridRunbookWorkerGroup ListByAutomationAccount. */
public final class Main {
/*
* x-ms-original-file: specification/automation/resource-manager/Microsoft.Automation/stable/2022-02-22/examples/listHybridRunbookWorkerGroup.json
*/
/**
* Sample code: List hybrid worker groups by Automation Account.
*
* @param manager Entry point to AutomationManager.
*/
public static void listHybridWorkerGroupsByAutomationAccount(
com.azure.resourcemanager.automation.AutomationManager manager) {
manager.hybridRunbookWorkerGroups().listByAutomationAccount("rg", "testaccount", null, Context.NONE);
}
}
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Automation;
using Azure.ResourceManager.Automation.Models;
// Generated from example definition: specification/automation/resource-manager/Microsoft.Automation/stable/2022-02-22/examples/listHybridRunbookWorkerGroup.json
// this example is just showing the usage of "HybridRunbookWorkerGroup_ListByAutomationAccount" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this AutomationAccountResource created on azure
// for more information of creating AutomationAccountResource, please refer to the document of AutomationAccountResource
string subscriptionId = "subid";
string resourceGroupName = "rg";
string automationAccountName = "testaccount";
ResourceIdentifier automationAccountResourceId = AutomationAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, automationAccountName);
AutomationAccountResource automationAccount = client.GetAutomationAccountResource(automationAccountResourceId);
// get the collection of this HybridRunbookWorkerGroupResource
HybridRunbookWorkerGroupCollection collection = automationAccount.GetHybridRunbookWorkerGroups();
// invoke the operation and iterate over the result
await foreach (HybridRunbookWorkerGroupResource item in collection.GetAllAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HybridRunbookWorkerGroupData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");