Share via


Storage Tasks - Create

Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}?api-version=2023-01-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.

storageTaskName
path True

string

minLength: 3
maxLength: 18
pattern: ^[a-z0-9]{3,18}$

The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
identity True

ManagedServiceIdentity

The managed service identity of the resource.

location True

string

The geo-location where the resource lives

properties.action True

StorageTaskAction

The storage task action that is executed

properties.description True

string

Text that describes the purpose of the storage task

properties.enabled True

boolean

Storage Task is enabled when set to true and disabled when set to false

tags

object

Resource tags.

Responses

Name Type Description
200 OK

StorageTask

Resource 'StorageTask' update operation succeeded

201 Created

StorageTask

Resource 'StorageTask' create operation succeeded

Headers

  • Location: string
  • Retry-After: integer
202 Accepted

Resource operation accepted.

Headers

  • Location: string
  • Retry-After: integer
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

PutStorageTask

Sample request

PUT https://management.azure.com/subscriptions/1f31ba14-ce16-4281-b9b4-3e78da6e1616/resourceGroups/res4228/providers/Microsoft.StorageActions/storageTasks/mytask1?api-version=2023-01-01

{
  "identity": {
    "type": "SystemAssigned"
  },
  "location": "westus",
  "properties": {
    "description": "My Storage task",
    "action": {
      "else": {
        "operations": [
          {
            "name": "DeleteBlob",
            "onFailure": "break",
            "onSuccess": "continue"
          }
        ]
      },
      "if": {
        "condition": "[[equals(AccessTier, 'Cool')]]",
        "operations": [
          {
            "name": "SetBlobTier",
            "onFailure": "break",
            "onSuccess": "continue",
            "parameters": {
              "tier": "Hot"
            }
          }
        ]
      }
    },
    "enabled": true
  }
}

Sample response

location: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.StorageActions/locations/eastus/operationResults/00000000-0000-0000-0000-000000000000?api-version=2023-01-01
{
  "name": "mytask1",
  "type": "Microsoft.StorageActions/storageTasks",
  "id": "/subscriptions/c86a9c18-8373-41fa-92d4-1d7bdc16977b/resourceGroups/res4228/providers/Microsoft.StorageActions/storageTasks/mytask1",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "2fd475e8-8923-4597-842f-7ce1adfc6c4a",
    "tenantId": "b4a2005c-32c1-434c-bbf0-ff486912fc75"
  },
  "location": "westus",
  "properties": {
    "description": "Storage task",
    "action": {
      "else": {
        "operations": [
          {
            "name": "DeleteBlob",
            "onFailure": "break",
            "onSuccess": "continue"
          }
        ]
      },
      "if": {
        "condition": "[[equals(AccessTier, 'Cool')]]",
        "operations": [
          {
            "name": "SetBlobTier",
            "onFailure": "break",
            "onSuccess": "continue",
            "parameters": {
              "tier": "Hot"
            }
          }
        ]
      }
    },
    "creationTimeInUtc": "2023-07-06T00:24:59.1441663Z",
    "enabled": true,
    "provisioningState": "Succeeded",
    "taskVersion": 1
  }
}
location: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.StorageActions/locations/eastus/operationResults/00000000-0000-0000-0000-000000000000?api-version=2023-01-01
{
  "name": "mytask1",
  "type": "Microsoft.StorageActions/storageTasks",
  "id": "/subscriptions/c86a9c18-8373-41fa-92d4-1d7bdc16977b/resourceGroups/res4228/providers/Microsoft.StorageActions/storageTasks/mytask1",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "2fd475e8-8923-4597-842f-7ce1adfc6c4a",
    "tenantId": "b4a2005c-32c1-434c-bbf0-ff486912fc75"
  },
  "location": "westus",
  "properties": {
    "description": "Storage task",
    "action": {
      "else": {
        "operations": [
          {
            "name": "DeleteBlob",
            "onFailure": "break",
            "onSuccess": "continue"
          }
        ]
      },
      "if": {
        "condition": "[[equals(AccessTier, 'Cool')]]",
        "operations": [
          {
            "name": "SetBlobTier",
            "onFailure": "break",
            "onSuccess": "continue",
            "parameters": {
              "tier": "Hot"
            }
          }
        ]
      }
    },
    "creationTimeInUtc": "2023-07-06T00:24:59.1441663Z",
    "enabled": true,
    "provisioningState": "Succeeded",
    "taskVersion": 1
  }
}
location: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.StorageActions/locations/eastus/operationResults/00000000-0000-0000-0000-000000000000?api-version=2023-01-01

Definitions

Name Description
createdByType

The type of identity that created the resource.

ElseCondition

The else block of storage task operation

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

IfCondition

The if block of storage task operation

ManagedServiceIdentity

Managed service identity (system assigned and/or user assigned identities)

ManagedServiceIdentityType

Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).

OnFailure

Action to be taken when the operation fails for a object.

OnSuccess

Action to be taken when the operation is successful for a object.

ProvisioningState

Represents the provisioning state of the storage task.

StorageTask

Represents Storage Task.

StorageTaskAction

The storage task action represents conditional statements and operations to be performed on target objects.

StorageTaskOperation

Represents an operation to be performed on the object

StorageTaskOperationName

The operation to be performed on the object.

systemData

Metadata pertaining to creation and last modification of the resource.

UserAssignedIdentity

User assigned identity properties

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

ElseCondition

The else block of storage task operation

Name Type Description
operations

StorageTaskOperation[]

List of operations to execute in the else block

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.

IfCondition

The if block of storage task operation

Name Type Description
condition

string

Condition predicate to evaluate each object. See https://aka.ms/storagetaskconditions for valid properties and operators.

operations

StorageTaskOperation[]

List of operations to execute when the condition predicate satisfies.

ManagedServiceIdentity

Managed service identity (system assigned and/or user assigned identities)

Name Type Description
principalId

string (uuid)

The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity.

tenantId

string (uuid)

The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.

type

ManagedServiceIdentityType

Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).

userAssignedIdentities

<string,  UserAssignedIdentity>

User-Assigned Identities
The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.

ManagedServiceIdentityType

Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).

Value Description
None
SystemAssigned
UserAssigned
SystemAssigned,UserAssigned

OnFailure

Action to be taken when the operation fails for a object.

Value Description
break

OnSuccess

Action to be taken when the operation is successful for a object.

Value Description
continue

ProvisioningState

Represents the provisioning state of the storage task.

Value Description
ValidateSubscriptionQuotaBegin
ValidateSubscriptionQuotaEnd
Accepted
Creating
Succeeded
Deleting
Canceled
Failed

StorageTask

Represents Storage Task.

Name Type Description
id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

identity

ManagedServiceIdentity

The managed service identity of the resource.

location

string

The geo-location where the resource lives

name

string

The name of the resource

properties.action

StorageTaskAction

The storage task action that is executed

properties.creationTimeInUtc

string (date-time)

The creation date and time of the storage task in UTC.

properties.description

string

Text that describes the purpose of the storage task

properties.enabled

boolean

Storage Task is enabled when set to true and disabled when set to false

properties.provisioningState

ProvisioningState

Represents the provisioning state of the storage task.

properties.taskVersion

integer (int64)

minimum: 1
maximum: 1

Storage task version.

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"

StorageTaskAction

The storage task action represents conditional statements and operations to be performed on target objects.

Name Type Description
else

ElseCondition

The else block of storage task operation

if

IfCondition

The if block of storage task operation

StorageTaskOperation

Represents an operation to be performed on the object

Name Type Description
name

StorageTaskOperationName

The operation to be performed on the object.

onFailure

OnFailure

Action to be taken when the operation fails for a object.

onSuccess

OnSuccess

Action to be taken when the operation is successful for a object.

parameters

object

Key-value parameters for the operation.

StorageTaskOperationName

The operation to be performed on the object.

Value Description
SetBlobTier
SetBlobTags
SetBlobImmutabilityPolicy
SetBlobLegalHold
SetBlobExpiry
DeleteBlob
UndeleteBlob

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 identity properties

Name Type Description
clientId

string (uuid)

The client ID of the assigned identity.

principalId

string (uuid)

The principal ID of the assigned identity.