Resource Deployment Script Power Shell Args
Manages a Resource Deployment Script of Azure PowerShell.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "example-resources",
location: "West Europe",
});
const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
name: "example-uai",
location: example.location,
resourceGroupName: example.name,
});
const exampleResourceDeploymentScriptPowerShell = new azure.core.ResourceDeploymentScriptPowerShell("example", {
name: "example-rdsaps",
resourceGroupName: example.name,
location: "West Europe",
version: "8.3",
retentionInterval: "P1D",
commandLine: "-name \"John Dole\"",
cleanupPreference: "OnSuccess",
forceUpdateTag: "1",
timeout: "PT30M",
scriptContent: ` param([string] name)
output = 'Hello {0}.' -f name
Write-Output output
DeploymentScriptOutputs = @{}
DeploymentScriptOutputs['text'] = output
`,
identity: {
type: "UserAssigned",
identityIds: [exampleUserAssignedIdentity.id],
},
tags: {
key: "value",
},
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
example_user_assigned_identity = azure.authorization.UserAssignedIdentity("example",
name="example-uai",
location=example.location,
resource_group_name=example.name)
example_resource_deployment_script_power_shell = azure.core.ResourceDeploymentScriptPowerShell("example",
name="example-rdsaps",
resource_group_name=example.name,
location="West Europe",
version="8.3",
retention_interval="P1D",
command_line="-name \"John Dole\"",
cleanup_preference="OnSuccess",
force_update_tag="1",
timeout="PT30M",
script_content=""" param([string] $name)
$output = 'Hello {0}.' -f $name
Write-Output $output
$DeploymentScriptOutputs = @{}
$DeploymentScriptOutputs['text'] = $output
""",
identity={
"type": "UserAssigned",
"identity_ids": [example_user_assigned_identity.id],
},
tags={
"key": "value",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-resources",
Location = "West Europe",
});
var exampleUserAssignedIdentity = new Azure.Authorization.UserAssignedIdentity("example", new()
{
Name = "example-uai",
Location = example.Location,
ResourceGroupName = example.Name,
});
var exampleResourceDeploymentScriptPowerShell = new Azure.Core.ResourceDeploymentScriptPowerShell("example", new()
{
Name = "example-rdsaps",
ResourceGroupName = example.Name,
Location = "West Europe",
Version = "8.3",
RetentionInterval = "P1D",
CommandLine = "-name \"John Dole\"",
CleanupPreference = "OnSuccess",
ForceUpdateTag = "1",
Timeout = "PT30M",
ScriptContent = @" param([string] $name)
$output = 'Hello {0}.' -f $name
Write-Output $output
$DeploymentScriptOutputs = @{}
$DeploymentScriptOutputs['text'] = $output
",
Identity = new Azure.Core.Inputs.ResourceDeploymentScriptPowerShellIdentityArgs
{
Type = "UserAssigned",
IdentityIds = new[]
{
exampleUserAssignedIdentity.Id,
},
},
Tags =
{
{ "key", "value" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/authorization"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-resources"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleUserAssignedIdentity, err := authorization.NewUserAssignedIdentity(ctx, "example", &authorization.UserAssignedIdentityArgs{
Name: pulumi.String("example-uai"),
Location: example.Location,
ResourceGroupName: example.Name,
})
if err != nil {
return err
}
_, err = core.NewResourceDeploymentScriptPowerShell(ctx, "example", &core.ResourceDeploymentScriptPowerShellArgs{
Name: pulumi.String("example-rdsaps"),
ResourceGroupName: example.Name,
Location: pulumi.String("West Europe"),
Version: pulumi.String("8.3"),
RetentionInterval: pulumi.String("P1D"),
CommandLine: pulumi.String("-name \"John Dole\""),
CleanupPreference: pulumi.String("OnSuccess"),
ForceUpdateTag: pulumi.String("1"),
Timeout: pulumi.String("PT30M"),
ScriptContent: pulumi.String(` param([string] $name)
$output = 'Hello {0}.' -f $name
Write-Output $output
$DeploymentScriptOutputs = @{}
$DeploymentScriptOutputs['text'] = $output
`),
Identity: &core.ResourceDeploymentScriptPowerShellIdentityArgs{
Type: pulumi.String("UserAssigned"),
IdentityIds: pulumi.StringArray{
exampleUserAssignedIdentity.ID(),
},
},
Tags: pulumi.StringMap{
"key": pulumi.String("value"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.authorization.UserAssignedIdentity;
import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
import com.pulumi.azure.core.ResourceDeploymentScriptPowerShell;
import com.pulumi.azure.core.ResourceDeploymentScriptPowerShellArgs;
import com.pulumi.azure.core.inputs.ResourceDeploymentScriptPowerShellIdentityArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-resources")
.location("West Europe")
.build());
var exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
.name("example-uai")
.location(example.location())
.resourceGroupName(example.name())
.build());
var exampleResourceDeploymentScriptPowerShell = new ResourceDeploymentScriptPowerShell("exampleResourceDeploymentScriptPowerShell", ResourceDeploymentScriptPowerShellArgs.builder()
.name("example-rdsaps")
.resourceGroupName(example.name())
.location("West Europe")
.version("8.3")
.retentionInterval("P1D")
.commandLine("-name \"John Dole\"")
.cleanupPreference("OnSuccess")
.forceUpdateTag("1")
.timeout("PT30M")
.scriptContent("""
param([string] $name)
$output = 'Hello {0}.' -f $name
Write-Output $output
$DeploymentScriptOutputs = @{}
$DeploymentScriptOutputs['text'] = $output
""")
.identity(ResourceDeploymentScriptPowerShellIdentityArgs.builder()
.type("UserAssigned")
.identityIds(exampleUserAssignedIdentity.id())
.build())
.tags(Map.of("key", "value"))
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleUserAssignedIdentity:
type: azure:authorization:UserAssignedIdentity
name: example
properties:
name: example-uai
location: ${example.location}
resourceGroupName: ${example.name}
exampleResourceDeploymentScriptPowerShell:
type: azure:core:ResourceDeploymentScriptPowerShell
name: example
properties:
name: example-rdsaps
resourceGroupName: ${example.name}
location: West Europe
version: '8.3'
retentionInterval: P1D
commandLine: -name "John Dole"
cleanupPreference: OnSuccess
forceUpdateTag: '1'
timeout: PT30M
scriptContent: |2
param([string] $name)
$output = 'Hello {0}.' -f $name
Write-Output $output
$DeploymentScriptOutputs = @{}
$DeploymentScriptOutputs['text'] = $output
identity:
type: UserAssigned
identityIds:
- ${exampleUserAssignedIdentity.id}
tags:
key: value
API Providers
This resource uses the following Azure API Providers:
Microsoft.Resources
: 2020-10-01
Import
Resource Deployment Script can be imported using the resource id
, e.g.
$ pulumi import azure:core/resourceDeploymentScriptPowerShell:ResourceDeploymentScriptPowerShell example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Resources/deploymentScripts/script1
Constructors
Properties
Specifies the cleanup preference when the script execution gets in a terminal state. Possible values are Always
, OnExpiration
, OnSuccess
. Defaults to Always
. Changing this forces a new Resource Deployment Script to be created.
Command line arguments to pass to the script. Changing this forces a new Resource Deployment Script to be created.
A container
block as defined below. Changing this forces a new Resource Deployment Script to be created.
An environment_variable
block as defined below. Changing this forces a new Resource Deployment Script to be created.
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. Changing this forces a new Resource Deployment Script to be created.
An identity
block as defined below. Changing this forces a new Resource Deployment Script to be created.
Specifies the name which should be used for this Resource Deployment Script. The name length must be from 1 to 260 characters. The name can only contain alphanumeric, underscore, parentheses, hyphen and period, and it cannot end with a period. Changing this forces a new Resource Deployment Script to be created.
Uri for the script. This is the entry point for the external script. Changing this forces a new Resource Deployment Script to be created.
Specifies the name of the Resource Group where the Resource Deployment Script should exist. Changing this forces a new Resource Deployment Script to be created.
Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. The time duration should be between 1
hour and 26
hours (inclusive) and should be specified in ISO 8601 format. Changing this forces a new Resource Deployment Script to be created.
Script body. Changing this forces a new Resource Deployment Script to be created.
A storage_account
block as defined below. Changing this forces a new Resource Deployment Script to be created.
Supporting files for the external script. Changing this forces a new Resource Deployment Script to be created.
Specifies the version of the Azure PowerShell that should be used in the format X.Y
(e.g. 9.7
). A canonical list of versions is available from the Microsoft Container Registry API. Changing this forces a new Resource Deployment Script to be created.