Share via


Deployment Scripts - Get

Gets a deployment script with a given name.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}?api-version=2020-10-01

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

scriptName
path True

string

minLength: 1
maxLength: 90

Name of the deployment script.

subscriptionId
path True

string

minLength: 1

The ID of the target subscription.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Responses

Name Type Description
200 OK DeploymentScript:

Azure operation completed successfully.

Other Status Codes

ErrorResponse

An unexpected error response.

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

DeploymentScriptsGet

Sample request

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/script-rg/providers/Microsoft.Resources/deploymentScripts/MyDeploymentScript?api-version=2020-10-01

Sample response

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/script-rg/providers/Microsoft.Resources/deploymentScripts/MyDeploymentScript",
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": {}
    }
  },
  "kind": "AzurePowerShell",
  "location": "westus",
  "properties": {
    "arguments": "-Location 'westus' -Name \"*rg2\"",
    "azPowerShellVersion": "1.7.0",
    "cleanupPreference": "Always",
    "outputs": {
      "output1": "value1"
    },
    "provisioningState": "Succeeded",
    "retentionInterval": "P7D",
    "scriptContent": "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name",
    "status": {
      "containerInstanceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer",
      "endTime": "2018-11-13T15:19:45-08:00",
      "expirationTime": "2018-11-13T15:19:45-08:00",
      "startTime": "2018-11-13T15:19:45-08:00",
      "storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"
    },
    "timeout": "PT1H"
  },
  "systemData": {
    "createdAt": "2020-02-01T01:01:01.1075056Z",
    "createdBy": "string",
    "createdByType": "Application",
    "lastModifiedAt": "2020-02-01T01:01:01.1075056Z",
    "lastModifiedBy": "string",
    "lastModifiedByType": "Application"
  }
}

Definitions

Name Description
AzureCliScript

Object model for the Azure CLI script.

AzurePowerShellScript

Object model for the Azure PowerShell script.

cleanupOptions

The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'.

ContainerConfiguration

Settings to customize ACI container instance.

createdByType

The type of identity that created the resource.

EnvironmentVariable

The environment variable to pass to the script in the container instance.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

ManagedServiceIdentity

Describes the managed identities for an Azure resource.

ManagedServiceIdentityType

Type of the managed identity.

ScriptProvisioningState

State of the script execution. This only appears in the response.

ScriptStatus

Generic object modeling results of script execution.

ScriptType

Type of the script.

StorageAccountConfiguration

Settings to use an existing storage account. Valid storage account kinds are: Storage, StorageV2 and FileStorage

systemData

Metadata pertaining to creation and last modification of the resource.

UserAssignedIdentity

User-assigned managed identity.

AzureCliScript

Object model for the Azure CLI script.

Name Type Default value Description
id

string

Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

identity

ManagedServiceIdentity

Optional property. Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported.

kind string:

AzureCLI

Type of the script.

location

string

The geo-location where the resource lives

name

string

The name of the resource

properties.arguments

string

Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'

properties.azCliVersion

string

Azure CLI module version to be used.

properties.cleanupPreference

cleanupOptions

Always

The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'.

properties.containerSettings

ContainerConfiguration

Container settings.

properties.environmentVariables

EnvironmentVariable[]

The environment variables to pass over to the script.

properties.forceUpdateTag

string

Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID.

properties.outputs

List of script outputs.

properties.primaryScriptUri

string

Uri for the script. This is the entry point for the external script.

properties.provisioningState

ScriptProvisioningState

State of the script execution. This only appears in the response.

properties.retentionInterval

string (duration)

Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P1D means one day).

properties.scriptContent

string

Script body.

properties.status

ScriptStatus

Contains the results of script execution.

properties.storageAccountSettings

StorageAccountConfiguration

Storage Account settings.

properties.supportingScriptUris

string[]

Supporting files for the external script.

properties.timeout

string (duration)

P1D

Maximum allowed script execution time specified in ISO 8601 format. Default value is P1D

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

tags

object

Resource tags.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

AzurePowerShellScript

Object model for the Azure PowerShell script.

Name Type Default value Description
id

string

Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

identity

ManagedServiceIdentity

Optional property. Managed identity to be used for this deployment script. Currently, only user-assigned MSI is supported.

kind string:

AzurePowerShell

Type of the script.

location

string

The geo-location where the resource lives

name

string

The name of the resource

properties.arguments

string

Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West US 2'

properties.azPowerShellVersion

string

Azure PowerShell module version to be used.

properties.cleanupPreference

cleanupOptions

Always

The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'.

properties.containerSettings

ContainerConfiguration

Container settings.

properties.environmentVariables

EnvironmentVariable[]

The environment variables to pass over to the script.

properties.forceUpdateTag

string

Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. Can be current time stamp or a GUID.

properties.outputs

List of script outputs.

properties.primaryScriptUri

string

Uri for the script. This is the entry point for the external script.

properties.provisioningState

ScriptProvisioningState

State of the script execution. This only appears in the response.

properties.retentionInterval

string (duration)

Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P1D means one day).

properties.scriptContent

string

Script body.

properties.status

ScriptStatus

Contains the results of script execution.

properties.storageAccountSettings

StorageAccountConfiguration

Storage Account settings.

properties.supportingScriptUris

string[]

Supporting files for the external script.

properties.timeout

string (duration)

P1D

Maximum allowed script execution time specified in ISO 8601 format. Default value is P1D

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

tags

object

Resource tags.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

cleanupOptions

The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'.

Value Description
Always

Always clean up the resources created by the script execution.

OnSuccess

Clean up the resources created by the script execution only if the script execution is successful.

OnExpiration

Clean up the resources created by the script execution only on expiration.

ContainerConfiguration

Settings to customize ACI container instance.

Name Type Description
containerGroupName

string

minLength: 1
maxLength: 63

Container group name, if not specified then the name will get auto-generated. Not specifying a 'containerGroupName' indicates the system to generate a unique name which might end up flagging an Azure Policy as non-compliant. Use 'containerGroupName' when you have an Azure Policy that expects a specific naming convention or when you want to fully control the name. 'containerGroupName' property must be between 1 and 63 characters long, must contain only lowercase letters, numbers, and dashes and it cannot start or end with a dash and consecutive dashes are not allowed. To specify a 'containerGroupName', add the following object to properties: { "containerSettings": { "containerGroupName": "contoso-container" } }. If you do not want to specify a 'containerGroupName' then do not add 'containerSettings' property.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

EnvironmentVariable

The environment variable to pass to the script in the container instance.

Name Type Description
name

string

The name of the environment variable.

secureValue

string

The value of the secure environment variable.

value

string

The value of the environment variable.

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

ManagedServiceIdentity

Describes the managed identities for an Azure resource.

Name Type Description
tenantId

string

The tenant id of the managed identity.

type

ManagedServiceIdentityType

Type of the managed identity.

userAssignedIdentities

<string,  UserAssignedIdentity>

The list of user-assigned managed identities associated with the resource. Key is the Azure resource Id of the managed identity.

ManagedServiceIdentityType

Type of the managed identity.

Value Description
UserAssigned

User assigned identity.

ScriptProvisioningState

State of the script execution. This only appears in the response.

Value Description
Creating

The script is being created.

ProvisioningResources

The script is provisioning resources.

Running

The script is running.

Succeeded

The script execution is succeeded.

Failed

The script execution has failed.

Canceled

The script was canceled.

ScriptStatus

Generic object modeling results of script execution.

Name Type Description
containerInstanceId

string

ACI resource Id.

endTime

string (date-time)

End time of the script execution.

error

ErrorDetail

Error that is relayed from the script execution.

expirationTime

string (date-time)

Time the deployment script resource will expire.

startTime

string (date-time)

Start time of the script execution.

storageAccountId

string

Storage account resource Id.

ScriptType

Type of the script.

Value Description
AzurePowerShell

Azure PowerShell script.

AzureCLI

Azure CLI script.

StorageAccountConfiguration

Settings to use an existing storage account. Valid storage account kinds are: Storage, StorageV2 and FileStorage

Name Type Description
storageAccountKey

string

The storage account access key.

storageAccountName

string

The storage account name.

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.

UserAssignedIdentity

User-assigned managed identity.

Name Type Description
clientId

string

Client App Id associated with this identity.

principalId

string

Azure Active Directory principal ID associated with this identity.