aws:assertAzureResourceProperty – Assert an Azure resource state
The aws:assertAzureResourceProperty action checks that a property of
a Microsoft Azure resource has one of a set of values. The action calls an
Azure API operation once, reads the property named by
PropertySelector from the response, and continues the automation only when the
value is in DesiredValues. Otherwise, the step fails.
The aws:assertAzureResourceProperty action is available in the
AWS Regions where Cloud Connector is available.
Input
You provide the same inputs as aws:executeAzureApi – Call and run Azure API operations, plus PropertySelector
and DesiredValues. This action doesn't return outputs.
- Service
-
The module name that follows
azure.mgmt.in the Azure SDK for Python. For example, specifycomputefor virtual machines (azure.mgmt.compute). For a library that has its client in a submodule, include the submodule, for exampleresource.resourcesfor resource groups. For more information about the services that the action doesn't support, see Limitations.Type: String
Required: Yes
- Api
-
The name of the API operation that you want to run, in the form
OperationGroup.Method, for exampleVirtualMachines.Get. You can also use the snake_case form, for examplevirtual_machines.get.Type: String
Required: Yes
- Package
-
The name of the published Azure SDK package that provides the operation. For more information about the available packages and the libraries in each, see Azure and Google Cloud SDK packages.
Type: String
Required: Yes
- CloudConnector
-
The ID of the Cloud Connector that reaches your Azure resources. For example,
a1b2c3d4-5678-90ab-cdef-111122223333.Type: String
Required: Yes
- SubscriptionId
-
The ID of the Azure subscription that contains the resource. This input is required, and the subscription must be one that the Cloud Connector allows.
Type: String
Required: Yes
- API operation parameters
-
Any other inputs that you add to the step are passed to the Azure API operation as its parameters, using the parameter names from the Azure REST API reference. For example,
VirtualMachines.GettakesresourceGroupName,vmName, and the optionalexpand. For more information, see Pass parameters and a request body.Type: Determined by the chosen API operation
Required: Determined by the chosen API operation
- Body
-
The request body of the API operation, if it takes one, as a JSON object in the shape that the Azure REST API reference shows. Most operations that read a property don't take a request body. Pass request-body properties in
Bodyrather than as separate step inputs.Type: StringMap
Required: Determined by the chosen API operation
- PropertySelector
-
The JSONPath to a specific attribute in the response object. Automation returns the Azure response as a JSON object. For more information about the JSONPath that you can use, see Select values from the response.
Type: String
Required: Yes
- DesiredValues
-
The values on which to continue the automation. Automation compares each value as a string, and the comparison is case-sensitive. If
PropertySelectormatches more than one value, every value must be inDesiredValues. A Boolean property matchesTrueorFalse.If the property is empty, the step fails with an error such as
Property value from the API output is empty. Desired values: ['PowerState/running']. If its value isn't in this list, the step fails with an error such asProperty value 'PowerState/deallocated' from the API output is not in the desired values. Desired values: ['PowerState/running']. If the API operation fails, for example because the resource doesn't exist, the step fails with the error that Azure returned.Type: StringList
Required: Yes
Automation signs in to Azure with the Cloud Connector. If the automation
has an AutomationAssumeRole, Automation uses that role to assume the
connector's federation role. Otherwise, it uses the credentials of the user who started the
automation. For more information about the permissions that each role needs, see Permissions for automations that use a Cloud Connector.
For more information about the operation names and services that the action supports, see Naming rules and Limitations.
Example – Assert that a virtual machine is running
The following step asserts that a virtual machine's power state is running. The power state is usually the second entry in the instance view's statuses list, so the example selects $.properties.instanceView.statuses[1].code.