Gets deployment script logs for a given deployment script name.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs?api-version=2020-10-01
URI Parameters
Name |
In |
Required |
Type |
Description |
resourceGroupName
|
path |
True
|
string
|
The name of the resource group. The name is case insensitive.
|
scriptName
|
path |
True
|
string
|
Name of the deployment script.
|
subscriptionId
|
path |
True
|
string
|
Subscription Id which forms part of the URI for every service call.
|
api-version
|
query |
True
|
string
|
Client Api version.
|
Responses
Name |
Type |
Description |
200 OK
|
ScriptLogsList
|
OK -- Returns deployment script logs if available.
|
Other Status Codes
|
DeploymentScriptsError
|
Error response describing why the operation failed.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
DeploymentScriptsGetLogs
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/script-rg/providers/Microsoft.Resources/deploymentScripts/MyDeploymentScript/logs?api-version=2020-10-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource import DeploymentScriptsClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-resource
# USAGE
python deployment_scripts_get_logs.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DeploymentScriptsClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deployment_scripts.get_logs(
resource_group_name="script-rg",
script_name="MyDeploymentScript",
)
print(response)
# x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogs.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdeploymentscripts_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeploymentscripts/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogs.json
func ExampleClient_GetLogs() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdeploymentscripts.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewClient().GetLogs(ctx, "script-rg", "MyDeploymentScript", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ScriptLogsList = armdeploymentscripts.ScriptLogsList{
// Value: []*armdeploymentscripts.ScriptLog{
// {
// Properties: &armdeploymentscripts.LogProperties{
// Log: to.Ptr("script execution stdout/stderr logs"),
// },
// }},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
// Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogs.json
// this example is just showing the usage of "DeploymentScripts_GetLogs" 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 ArmDeploymentScriptResource created on azure
// for more information of creating ArmDeploymentScriptResource, please refer to the document of ArmDeploymentScriptResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "script-rg";
string scriptName = "MyDeploymentScript";
ResourceIdentifier armDeploymentScriptResourceId = ArmDeploymentScriptResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, scriptName);
ArmDeploymentScriptResource armDeploymentScript = client.GetArmDeploymentScriptResource(armDeploymentScriptResourceId);
// invoke the operation and iterate over the result
await foreach (ScriptLogResource item in armDeploymentScript.GetLogsAsync())
{
// 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
ScriptLogData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"properties": {
"log": "script execution stdout/stderr logs"
}
}
]
}
Definitions
DeploymentScriptsError
Deployment scripts error response.
Name |
Type |
Description |
error
|
ErrorResponse
|
Error Response
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)
|
ErrorAdditionalInfo
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorResponse
Error Response
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorResponse[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ScriptLog
Script execution log object.
Name |
Type |
Description |
id
|
string
|
String Id used to locate any resource on Azure.
|
name
|
string
|
Name of this resource.
|
properties.log
|
string
|
Script execution logs in text format.
|
type
|
string
|
Type of this resource.
|
ScriptLogsList
Deployment script execution logs.
Name |
Type |
Description |
value
|
ScriptLog[]
|
Deployment scripts logs.
|