Package Management helps you create packages of automation resources and deploy them
A package consists of related
Note: support for certificates & connections will be added soon.
Install-Module -Name AzureAutomationTools.PackageManagement
Windows Powershell 5.1 (only tested with 5.1.14393.953)
You can create a new package in the current folder.
New-AatAutomationPackage -Name 'monkey'
This will create the following:
.\monkey
.\monkey\assets
.\monkey\modules
.\monkey\runbooks
.\monkey\assets\assets.json
The file assets.json contains
{
"Credentials": [],
"Variables": []
}
Specifying the -IncludeSamples switch will create sample files in the package
New-AatAutomationPackage -Name 'monkey' -IncludeSamples
will additionally create
.\monkey\assets\sample-assets.json
sample-assets.json will contains something similar to:
{
"Credentials": [
{
"Name": "ExampleCredential",
"Username": "user@exmaple.com"
}
],
"Variables": [
{
"Name": "simple-plaintext-variable",
"IsEncrypted": false,
"Value": "lorem"
},
{
"Name": "simple-encrypted-variable",
"IsEncrypted": true,
"Value": null
},
{
"Name": "object-variable",
"IsEncrypted": false,
"Value": {
"ComplexProperty": {
"Ipsum": 1,
"Dolor": "monkey"
},
"SimpleProperty": "Lorem"
}
}
]
}
You can add variables to an assets file manually but to avoid errors you can do the following
Add-AatVariableDefinition -Name 'bert' -Value 'ernie'
{
"Credentials": [],
"Variables": [
{
"Name": "bert",
"IsEncrypted": false,
"Value": "ernie"
}
]
}
Credentials must be added manually to an assets file.
{
"Credentials": [],
"Variables": []
}
e.g.
{
"Credentials": [
{
"Name" : "ExampleCredential",
"UserName" : "user@example.com"
}
],
"Variables": []
}
You can test a package by executing:
Test-AatAutomationPackage
which will give output similar to:
Message Severity
------- --------
No module defintions found in '.\monkey\modules' Warning
No runbooks found in '.\monkey\runbooks' Warning
To publish all package in the current folder
$Params = @{
ResourceGroupName = "rg";
AutomationAccountName = "aa";
DeployRunbooks = $true;
DeployModules = $true;
DeployVariables = $true;
DeployCredentials = $true;
NewCredentialsOnly = $true;
}
Publish-AatAutomationPackage @Params
To publish only the monkey package
$Params = @{
ResourceGroupName = "rg";
AutomationAccountName = "aa";
DeployRunbooks = $true;
DeployModules = $true;
DeployVariables = $true;
DeployCredentials = $true;
NewCredentialsOnly = $true;
}
Publish-AatAutomationPackage @Params -PackageName 'monkey'