Runbook - Get Content
Pobierz zawartość elementu Runbook zidentyfikowanego przez nazwę elementu Runbook.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content?api-version=2023-11-01
Parametry identyfikatora URI
Nazwa | W | Wymagane | Typ | Opis |
---|---|---|---|---|
automation
|
path | True |
string |
Nazwa konta usługi Automation. |
resource
|
path | True |
string |
Nazwa grupy zasobów platformy Azure. Wzorzec wyrażenia regularnego: |
runbook
|
path | True |
string |
Nazwa elementu runbook. Wzorzec wyrażenia regularnego: |
subscription
|
path | True |
string |
Pobiera poświadczenia subskrypcji, które jednoznacznie identyfikują subskrypcję platformy Microsoft Azure. Identyfikator subskrypcji stanowi część identyfikatora URI dla każdego wywołania usługi. |
api-version
|
query | True |
string |
Wersja interfejsu API klienta. |
Odpowiedzi
Nazwa | Typ | Opis |
---|---|---|
200 OK |
file |
OK Media Types: "text/powershell" |
Other Status Codes |
Odpowiedź na błąd automatyzacji opisująca, dlaczego operacja nie powiodła się. Media Types: "text/powershell" |
Zabezpieczenia
azure_auth
Przepływ OAuth2 usługi Azure Active Directory
Typ:
oauth2
Flow:
implicit
Adres URL autoryzacji:
https://login.microsoftonline.com/common/oauth2/authorize
Zakresy
Nazwa | Opis |
---|---|
user_impersonation | personifikacja konta użytkownika |
Przykłady
Get runbook content
Przykładowe żądanie
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/runbooks/Get-AzureVMTutorial/content?api-version=2023-11-01
Przykładowa odpowiedź
Content-Type: text/powershell
"<#\r\n .DESCRIPTION\r\n An example runbook which prints out the first10 Azure VMs in your subscription (ordered alphabetically).\r\n For more information about how this runbook authenticates to your Azure subscription, see our documentation here: http: //aka.ms/fxu3mn\r\n\r\n .NOTES\r\n AUTHOR: Azure Automation Team\r\n LASTEDIT: Mar27,\r\n 2015\r\n#>\r\nworkflow Get-AzureVMTutorial{\r\n #The name of the Automation Credential Asset this runbook will use to authenticate to Azure.\r\n $CredentialAssetName = 'DefaultAzureCredential'\r\n\r\n #Get the credential with the above name from the Automation Asset store\r\n $Cred = Get-AutomationPSCredential -Name $CredentialAssetName\r\n if(!$Cred){\r\n Throw\"Could not find an Automation Credential Asset named '${CredentialAssetName}'. Make sure you have created one in this Automation Account.\"\r\n }\r\n\r\n #Connect to your Azure Account\r\n $Account = Add-AzureAccount -Credential $Cred\r\n if(!$Account){\r\n Throw\"Could not authenticate to Azure using the credential asset '${CredentialAssetName}'. Make sure the user name and password are correct.\"\r\n }\r\n\r\n #TODO (optional): pick the right subscription to use. Without this line, the default subscription for your Azure Account will be used.\r\n #Select-AzureSubscription -SubscriptionName\"TODO: your Azure subscription name here\"\r\n \r\n #Get all the VMs you have in your Azure subscription\r\n $VMs = Get-AzureVM\r\n\r\n #Print out up to10 of those VMs\r\n if(!$VMs){\r\n Write-Output\"No VMs were found in your subscription.\"\r\n } else{\r\n Write-Output $VMs[0..9\r\n ]\r\n }\r\n }"
Definicje
ErrorResponse
Odpowiedź na błąd operacji
Nazwa | Typ | Opis |
---|---|---|
code |
string |
Kod błędu |
message |
string |
Komunikat o błędzie wskazujący, dlaczego operacja nie powiodła się. |