We recommend using Azure Native.
azure.automation.SourceControl
Explore with Pulumi AI
Manages an Automation Source Control.
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 exampleAccount = new azure.automation.Account("example", {
name: "example-account",
location: example.location,
resourceGroupName: example.name,
skuName: "Basic",
});
const exampleSourceControl = new azure.automation.SourceControl("example", {
name: "example",
automationAccountId: exampleAccount.id,
folderPath: "runbook",
security: {
token: "ghp_xxx",
tokenType: "PersonalAccessToken",
},
repositoryUrl: "https://github.com/foo/bat.git",
sourceControlType: "GitHub",
branch: "main",
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
example_account = azure.automation.Account("example",
name="example-account",
location=example.location,
resource_group_name=example.name,
sku_name="Basic")
example_source_control = azure.automation.SourceControl("example",
name="example",
automation_account_id=example_account.id,
folder_path="runbook",
security={
"token": "ghp_xxx",
"token_type": "PersonalAccessToken",
},
repository_url="https://github.com/foo/bat.git",
source_control_type="GitHub",
branch="main")
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/automation"
"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
}
exampleAccount, err := automation.NewAccount(ctx, "example", &automation.AccountArgs{
Name: pulumi.String("example-account"),
Location: example.Location,
ResourceGroupName: example.Name,
SkuName: pulumi.String("Basic"),
})
if err != nil {
return err
}
_, err = automation.NewSourceControl(ctx, "example", &automation.SourceControlArgs{
Name: pulumi.String("example"),
AutomationAccountId: exampleAccount.ID(),
FolderPath: pulumi.String("runbook"),
Security: &automation.SourceControlSecurityArgs{
Token: pulumi.String("ghp_xxx"),
TokenType: pulumi.String("PersonalAccessToken"),
},
RepositoryUrl: pulumi.String("https://github.com/foo/bat.git"),
SourceControlType: pulumi.String("GitHub"),
Branch: pulumi.String("main"),
})
if err != nil {
return err
}
return nil
})
}
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 exampleAccount = new Azure.Automation.Account("example", new()
{
Name = "example-account",
Location = example.Location,
ResourceGroupName = example.Name,
SkuName = "Basic",
});
var exampleSourceControl = new Azure.Automation.SourceControl("example", new()
{
Name = "example",
AutomationAccountId = exampleAccount.Id,
FolderPath = "runbook",
Security = new Azure.Automation.Inputs.SourceControlSecurityArgs
{
Token = "ghp_xxx",
TokenType = "PersonalAccessToken",
},
RepositoryUrl = "https://github.com/foo/bat.git",
SourceControlType = "GitHub",
Branch = "main",
});
});
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.automation.Account;
import com.pulumi.azure.automation.AccountArgs;
import com.pulumi.azure.automation.SourceControl;
import com.pulumi.azure.automation.SourceControlArgs;
import com.pulumi.azure.automation.inputs.SourceControlSecurityArgs;
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 exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.name("example-account")
.location(example.location())
.resourceGroupName(example.name())
.skuName("Basic")
.build());
var exampleSourceControl = new SourceControl("exampleSourceControl", SourceControlArgs.builder()
.name("example")
.automationAccountId(exampleAccount.id())
.folderPath("runbook")
.security(SourceControlSecurityArgs.builder()
.token("ghp_xxx")
.tokenType("PersonalAccessToken")
.build())
.repositoryUrl("https://github.com/foo/bat.git")
.sourceControlType("GitHub")
.branch("main")
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleAccount:
type: azure:automation:Account
name: example
properties:
name: example-account
location: ${example.location}
resourceGroupName: ${example.name}
skuName: Basic
exampleSourceControl:
type: azure:automation:SourceControl
name: example
properties:
name: example
automationAccountId: ${exampleAccount.id}
folderPath: runbook
security:
token: ghp_xxx
tokenType: PersonalAccessToken
repositoryUrl: https://github.com/foo/bat.git
sourceControlType: GitHub
branch: main
Create SourceControl Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SourceControl(name: string, args: SourceControlArgs, opts?: CustomResourceOptions);
@overload
def SourceControl(resource_name: str,
args: SourceControlArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SourceControl(resource_name: str,
opts: Optional[ResourceOptions] = None,
automation_account_id: Optional[str] = None,
folder_path: Optional[str] = None,
repository_url: Optional[str] = None,
security: Optional[SourceControlSecurityArgs] = None,
source_control_type: Optional[str] = None,
automatic_sync: Optional[bool] = None,
branch: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None,
publish_runbook_enabled: Optional[bool] = None)
func NewSourceControl(ctx *Context, name string, args SourceControlArgs, opts ...ResourceOption) (*SourceControl, error)
public SourceControl(string name, SourceControlArgs args, CustomResourceOptions? opts = null)
public SourceControl(String name, SourceControlArgs args)
public SourceControl(String name, SourceControlArgs args, CustomResourceOptions options)
type: azure:automation:SourceControl
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args SourceControlArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SourceControlArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SourceControlArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SourceControlArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SourceControlArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var azureSourceControlResource = new Azure.Automation.SourceControl("azureSourceControlResource", new()
{
AutomationAccountId = "string",
FolderPath = "string",
RepositoryUrl = "string",
Security = new Azure.Automation.Inputs.SourceControlSecurityArgs
{
Token = "string",
TokenType = "string",
RefreshToken = "string",
},
SourceControlType = "string",
AutomaticSync = false,
Branch = "string",
Description = "string",
Name = "string",
PublishRunbookEnabled = false,
});
example, err := automation.NewSourceControl(ctx, "azureSourceControlResource", &automation.SourceControlArgs{
AutomationAccountId: pulumi.String("string"),
FolderPath: pulumi.String("string"),
RepositoryUrl: pulumi.String("string"),
Security: &automation.SourceControlSecurityArgs{
Token: pulumi.String("string"),
TokenType: pulumi.String("string"),
RefreshToken: pulumi.String("string"),
},
SourceControlType: pulumi.String("string"),
AutomaticSync: pulumi.Bool(false),
Branch: pulumi.String("string"),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
PublishRunbookEnabled: pulumi.Bool(false),
})
var azureSourceControlResource = new SourceControl("azureSourceControlResource", SourceControlArgs.builder()
.automationAccountId("string")
.folderPath("string")
.repositoryUrl("string")
.security(SourceControlSecurityArgs.builder()
.token("string")
.tokenType("string")
.refreshToken("string")
.build())
.sourceControlType("string")
.automaticSync(false)
.branch("string")
.description("string")
.name("string")
.publishRunbookEnabled(false)
.build());
azure_source_control_resource = azure.automation.SourceControl("azureSourceControlResource",
automation_account_id="string",
folder_path="string",
repository_url="string",
security={
"token": "string",
"token_type": "string",
"refresh_token": "string",
},
source_control_type="string",
automatic_sync=False,
branch="string",
description="string",
name="string",
publish_runbook_enabled=False)
const azureSourceControlResource = new azure.automation.SourceControl("azureSourceControlResource", {
automationAccountId: "string",
folderPath: "string",
repositoryUrl: "string",
security: {
token: "string",
tokenType: "string",
refreshToken: "string",
},
sourceControlType: "string",
automaticSync: false,
branch: "string",
description: "string",
name: "string",
publishRunbookEnabled: false,
});
type: azure:automation:SourceControl
properties:
automaticSync: false
automationAccountId: string
branch: string
description: string
folderPath: string
name: string
publishRunbookEnabled: false
repositoryUrl: string
security:
refreshToken: string
token: string
tokenType: string
sourceControlType: string
SourceControl Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The SourceControl resource accepts the following input properties:
- Automation
Account stringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- Folder
Path string - The folder path of the source control. This Path must be relative.
- Repository
Url string - The Repository URL of the source control.
- Security
Source
Control Security - A
security
block as defined below. - Source
Control stringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive. - Automatic
Sync bool - Whether auto async the Source Control.
- Branch string
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - Description string
- A short description of the Source Control.
- Name string
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- Publish
Runbook boolEnabled - Whether auto publish the Source Control. Defaults to
true
.
- Automation
Account stringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- Folder
Path string - The folder path of the source control. This Path must be relative.
- Repository
Url string - The Repository URL of the source control.
- Security
Source
Control Security Args - A
security
block as defined below. - Source
Control stringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive. - Automatic
Sync bool - Whether auto async the Source Control.
- Branch string
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - Description string
- A short description of the Source Control.
- Name string
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- Publish
Runbook boolEnabled - Whether auto publish the Source Control. Defaults to
true
.
- automation
Account StringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- folder
Path String - The folder path of the source control. This Path must be relative.
- repository
Url String - The Repository URL of the source control.
- security
Source
Control Security - A
security
block as defined below. - source
Control StringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive. - automatic
Sync Boolean - Whether auto async the Source Control.
- branch String
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - description String
- A short description of the Source Control.
- name String
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- publish
Runbook BooleanEnabled - Whether auto publish the Source Control. Defaults to
true
.
- automation
Account stringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- folder
Path string - The folder path of the source control. This Path must be relative.
- repository
Url string - The Repository URL of the source control.
- security
Source
Control Security - A
security
block as defined below. - source
Control stringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive. - automatic
Sync boolean - Whether auto async the Source Control.
- branch string
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - description string
- A short description of the Source Control.
- name string
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- publish
Runbook booleanEnabled - Whether auto publish the Source Control. Defaults to
true
.
- automation_
account_ strid - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- folder_
path str - The folder path of the source control. This Path must be relative.
- repository_
url str - The Repository URL of the source control.
- security
Source
Control Security Args - A
security
block as defined below. - source_
control_ strtype - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive. - automatic_
sync bool - Whether auto async the Source Control.
- branch str
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - description str
- A short description of the Source Control.
- name str
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- publish_
runbook_ boolenabled - Whether auto publish the Source Control. Defaults to
true
.
- automation
Account StringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- folder
Path String - The folder path of the source control. This Path must be relative.
- repository
Url String - The Repository URL of the source control.
- security Property Map
- A
security
block as defined below. - source
Control StringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive. - automatic
Sync Boolean - Whether auto async the Source Control.
- branch String
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - description String
- A short description of the Source Control.
- name String
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- publish
Runbook BooleanEnabled - Whether auto publish the Source Control. Defaults to
true
.
Outputs
All input properties are implicitly available as output properties. Additionally, the SourceControl resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing SourceControl Resource
Get an existing SourceControl resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SourceControlState, opts?: CustomResourceOptions): SourceControl
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
automatic_sync: Optional[bool] = None,
automation_account_id: Optional[str] = None,
branch: Optional[str] = None,
description: Optional[str] = None,
folder_path: Optional[str] = None,
name: Optional[str] = None,
publish_runbook_enabled: Optional[bool] = None,
repository_url: Optional[str] = None,
security: Optional[SourceControlSecurityArgs] = None,
source_control_type: Optional[str] = None) -> SourceControl
func GetSourceControl(ctx *Context, name string, id IDInput, state *SourceControlState, opts ...ResourceOption) (*SourceControl, error)
public static SourceControl Get(string name, Input<string> id, SourceControlState? state, CustomResourceOptions? opts = null)
public static SourceControl get(String name, Output<String> id, SourceControlState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Automatic
Sync bool - Whether auto async the Source Control.
- Automation
Account stringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- Branch string
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - Description string
- A short description of the Source Control.
- Folder
Path string - The folder path of the source control. This Path must be relative.
- Name string
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- Publish
Runbook boolEnabled - Whether auto publish the Source Control. Defaults to
true
. - Repository
Url string - The Repository URL of the source control.
- Security
Source
Control Security - A
security
block as defined below. - Source
Control stringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive.
- Automatic
Sync bool - Whether auto async the Source Control.
- Automation
Account stringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- Branch string
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - Description string
- A short description of the Source Control.
- Folder
Path string - The folder path of the source control. This Path must be relative.
- Name string
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- Publish
Runbook boolEnabled - Whether auto publish the Source Control. Defaults to
true
. - Repository
Url string - The Repository URL of the source control.
- Security
Source
Control Security Args - A
security
block as defined below. - Source
Control stringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive.
- automatic
Sync Boolean - Whether auto async the Source Control.
- automation
Account StringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- branch String
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - description String
- A short description of the Source Control.
- folder
Path String - The folder path of the source control. This Path must be relative.
- name String
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- publish
Runbook BooleanEnabled - Whether auto publish the Source Control. Defaults to
true
. - repository
Url String - The Repository URL of the source control.
- security
Source
Control Security - A
security
block as defined below. - source
Control StringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive.
- automatic
Sync boolean - Whether auto async the Source Control.
- automation
Account stringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- branch string
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - description string
- A short description of the Source Control.
- folder
Path string - The folder path of the source control. This Path must be relative.
- name string
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- publish
Runbook booleanEnabled - Whether auto publish the Source Control. Defaults to
true
. - repository
Url string - The Repository URL of the source control.
- security
Source
Control Security - A
security
block as defined below. - source
Control stringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive.
- automatic_
sync bool - Whether auto async the Source Control.
- automation_
account_ strid - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- branch str
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - description str
- A short description of the Source Control.
- folder_
path str - The folder path of the source control. This Path must be relative.
- name str
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- publish_
runbook_ boolenabled - Whether auto publish the Source Control. Defaults to
true
. - repository_
url str - The Repository URL of the source control.
- security
Source
Control Security Args - A
security
block as defined below. - source_
control_ strtype - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive.
- automatic
Sync Boolean - Whether auto async the Source Control.
- automation
Account StringId - The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
- branch String
- Specify the repo branch of the Source Control. Empty value is valid only for
VsoTfvc
. - description String
- A short description of the Source Control.
- folder
Path String - The folder path of the source control. This Path must be relative.
- name String
- The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
- publish
Runbook BooleanEnabled - Whether auto publish the Source Control. Defaults to
true
. - repository
Url String - The Repository URL of the source control.
- security Property Map
- A
security
block as defined below. - source
Control StringType - The source type of Source Control, possible vaules are
VsoGit
,VsoTfvc
andGitHub
, and the value is case sensitive.
Supporting Types
SourceControlSecurity, SourceControlSecurityArgs
- Token string
- The access token of specified repo.
- Token
Type string - Specify the token type, possible values are
PersonalAccessToken
andOauth
. - Refresh
Token string - The refresh token of specified rpeo.
- Token string
- The access token of specified repo.
- Token
Type string - Specify the token type, possible values are
PersonalAccessToken
andOauth
. - Refresh
Token string - The refresh token of specified rpeo.
- token String
- The access token of specified repo.
- token
Type String - Specify the token type, possible values are
PersonalAccessToken
andOauth
. - refresh
Token String - The refresh token of specified rpeo.
- token string
- The access token of specified repo.
- token
Type string - Specify the token type, possible values are
PersonalAccessToken
andOauth
. - refresh
Token string - The refresh token of specified rpeo.
- token str
- The access token of specified repo.
- token_
type str - Specify the token type, possible values are
PersonalAccessToken
andOauth
. - refresh_
token str - The refresh token of specified rpeo.
- token String
- The access token of specified repo.
- token
Type String - Specify the token type, possible values are
PersonalAccessToken
andOauth
. - refresh
Token String - The refresh token of specified rpeo.
Import
Automations can be imported using the resource id
, e.g.
$ pulumi import azure:automation/sourceControl:SourceControl example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/sourceControls/sc1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.