ARMTemplates/ProvanceCloudConnector.json

{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "9.2.0.0",
"parameters": {
    "deploymentMode": {
        "type": "string",
        "defaultvalue": "Incremental",
        "allowedValues": [
            "Incremental",
            "Complete"
        ]
    },
    "accountName": {
        "type": "string"
    },
    "location": {
        "type": "string"
    },
    "sku": {
        "type": "string",
        "allowedvalues": [
            "Free",
            "Basic"
        ],
        "defaultvalue": "Basic"
    },
    "doNotSync": {
        "type": "bool",
        "defaultvalue": true
    },
    "TenantFQDN": {
        "type": "string"
    },
    "ApplicationId": {
        "type": "string"
    },
    "ApplicationKey": {
        "type": "string"
    },
    "SchedSubStartTime": {
        "type": "string"
    },
    "SchedComputeStartTime": {
        "type": "string"
    },
    "SchedServMapStartTime": {
        "type": "string"
    },
    "SchedCloudProvStartTime": {
        "type": "string"
    },
    "MSCloudSolutionProvider": {
        "type": "string",
        "allowedvalues": [
            "yes",
            "no"
        ],
        "defaultvalue": "no"
    },
    "CreateSampleConnections": {
        "type": "string",
        "allowedvalues": [
            "yes",
            "no"
        ],
        "defaultvalue": "no"
    }
},
"variables": {
    "AAApiVersion" : "2018-01-15",
    "PCCVersion": {
        "type": "string"
    },
    "Modules": {
       "ModuleAzure": {
           "Name": "Provance.Azure",
           "Version": "1.0.2"
       },
       "ModuleDyn365": {
           "Name": "Provance.Dyn365",
           "Version": "1.0.2"
       },
       "ModuleCloudConnector": {
           "Name": "Provance.CloudConnector",
           "Version": "1.0.2"
       },
       "ModuleCloudProvider": {
           "Name": "Provance.CloudProvider",
           "Version": "1.2.1"
       }
    },
    "Runbooks": {
       "UpdMod": {
           "Name": "Update-ProvCCModules",
           "Version": "1.0.2"
       },
       "SynAzSub": {
           "Name": "Sync-ProvAzureSubscription",
           "Version": "1.0.2"
       },
       "RemAzSub": {
           "Name": "Remove-ProvAzureSubscription",
           "Version": "1.0.2"
       },
       "SetAzSubIn": {
           "Name": "Set-ProvAzureSubscriptionInactive",
           "Version": "1.0.2"
       },
       "SynAzComp": {
           "Name": "Sync-ProvAzureCompute",
           "Version": "1.0.2"
        },
        "SynAzSM": {
            "Name": "Sync-ProvAzureServiceMap",
            "Version": "1.0.2"
        },
        "SynCloudProv": {
            "Name": "Sync-ProvCloudProvider",
            "Version": "1.2.1"
        }
    }
},
"resources": [
    {
        "name": "[parameters('accountName')]",
        "type": "Microsoft.Automation/automationAccounts",
        "apiVersion": "[variables('AAApiVersion')]",
        "location": "[parameters('location')]",
        "dependsOn": [],
        "tags": {
            "PCC-HoldsPCC": "true",
            "PCC-DoNotSync": "[parameters('DoNotSync')]"
        },
        "properties": {
            "mode": "[parameters('deploymentMode')]",
            "sku": {
                "name": "[parameters('sku')]"
            }
        }
    },
    {
        "apiVersion": "2017-05-10",
        "name": "Modules",
        "type": "Microsoft.Resources/deployments",
        "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
        ],
        "properties": {
            "mode": "Incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentVersion": "9.2.0.0",
                "resources": [
                    {
                        "type": "Microsoft.Automation/automationAccounts/modules",
                        "name": "[concat(parameters('accountName'), '/', variables('Modules').ModuleAzure.Name)]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "contentLink": {
                                "uri": "[concat('https://www.powershellgallery.com/api/v2/package/',variables('Modules').ModuleAzure.Name,'/',variables('Modules').ModuleAzure.Version)]",
                                "version": "[variables('Modules').ModuleAzure.Version]"
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/', variables('Modules').ModuleCloudConnector.Name)]",
                        "type": "Microsoft.Automation/automationAccounts/modules",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "contentLink": {
                                "uri": "[concat('https://www.powershellgallery.com/api/v2/package/',variables('Modules').ModuleCloudConnector.Name,'/',variables('Modules').ModuleCloudConnector.Version)]",
                                "version": "[variables('Modules').ModuleCloudConnector.Version]"
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/', variables('Modules').ModuleDyn365.Name)]",
                        "type": "Microsoft.Automation/automationAccounts/modules",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "contentLink": {
                                "uri": "[concat('https://www.powershellgallery.com/api/v2/package/',variables('Modules').ModuleDyn365.Name,'/',variables('Modules').ModuleDyn365.Version)]",
                                "version": "[variables('Modules').ModuleDyn365.Version]"
                            }
                        }
                    },
                    {
                        "condition": "[equals(parameters('MSCloudSolutionProvider'), 'yes')]",
                        "name": "[concat(parameters('accountName'), '/', variables('Modules').ModuleCloudProvider.Name)]",
                        "type": "Microsoft.Automation/automationAccounts/modules",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "contentLink": {
                                "uri": "[concat('https://www.powershellgallery.com/api/v2/package/',variables('Modules').ModuleCloudProvider.Name,'/',variables('Modules').ModuleCloudProvider.Version)]",
                                "version": "[variables('Modules').ModuleCloudProvider.Version]"
                            }
                        }
                    }
                ]
            }
        }
    },
    {
        "apiVersion": "2017-05-10",
        "name": "Runbooks",
        "type": "Microsoft.Resources/deployments",
        "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
        ],
        "properties": {
            "mode": "Incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentVersion": "9.2.0.0",
                "resources": [
                    {
                        "name": "[concat(parameters('accountName'), '/',variables('Runbooks').SynAzSub.Name)]",
                        "type": "Microsoft.Automation/automationAccounts/runbooks",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "location": "[resourceGroup().location]",
                        "properties": {
                            "runbookType": "PowerShell",
                            "logProgress": true,
                            "logVerbose": false,
                            "description": "Created by Provance Cloud Connector deployment. Sync Azure Subscriptions to ITSM",
                            "publishContentLink": {
                                "uri": "[concat('https://www.PowerShellGallery.com/api/v2/items/psscript/package/',variables('Runbooks').SynAzSub.Name,'/',variables('Runbooks').SynAzSub.Version, '/',variables('Runbooks').SynAzSub.Name,'.ps1')]",
                                "version": "[variables('Runbooks').SynAzSub.Version]"
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/',variables('Runbooks').RemAzSub.Name)]",
                        "type": "Microsoft.Automation/automationAccounts/runbooks",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "location": "[resourceGroup().location]",
                        "properties": {
                            "runbookType": "PowerShell",
                            "logProgress": true,
                            "logVerbose": false,
                            "description": "Created by Provance Cloud Connector deployment. For internal use",
                            "publishContentLink": {
                                "uri": "[concat('https://www.PowerShellGallery.com/api/v2/items/psscript/package/',variables('Runbooks').RemAzSub.Name,'/',variables('Runbooks').RemAzSub.Version, '/',variables('Runbooks').RemAzSub.Name,'.ps1')]",
                                "version": "[variables('Runbooks').RemAzSub.Version]"
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/',variables('Runbooks').SetAzSubIn.Name)]",
                        "type": "Microsoft.Automation/automationAccounts/runbooks",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "location": "[resourceGroup().location]",
                        "properties": {
                            "runbookType": "PowerShell",
                            "logProgress": true,
                            "logVerbose": false,
                            "description": "Created by Provance Cloud Connector deployment. For internal use",
                            "publishContentLink": {
                                "uri": "[concat('https://www.PowerShellGallery.com/api/v2/items/psscript/package/',variables('Runbooks').SetAzSubIn.Name,'/',variables('Runbooks').SetAzSubIn.Version, '/',variables('Runbooks').SetAzSubIn.Name,'.ps1')]",
                                "version": "[variables('Runbooks').SetAzSubIn.Version]"
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/',variables('Runbooks').SynAzComp.Name)]",
                        "type": "Microsoft.Automation/automationAccounts/runbooks",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "location": "[resourceGroup().location]",
                        "properties": {
                            "runbookType": "PowerShell",
                            "logProgress": true,
                            "logVerbose": false,
                            "description": "Created by Provance Cloud Connector deployment. Sync Compute Resources",
                            "publishContentLink": {
                                "uri": "[concat('https://www.PowerShellGallery.com/api/v2/items/psscript/package/',variables('Runbooks').SynAzComp.Name,'/',variables('Runbooks').SynAzComp.Version, '/',variables('Runbooks').SynAzComp.Name,'.ps1')]",
                                "version": "[variables('Runbooks').SynAzComp.Version]"
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/',variables('Runbooks').SynAzSM.Name)]",
                        "type": "Microsoft.Automation/automationAccounts/runbooks",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "location": "[resourceGroup().location]",
                        "properties": {
                            "runbookType": "PowerShell",
                            "logProgress": true,
                            "logVerbose": false,
                            "description": "Created by Provance Cloud Connector deployment. Sync ServiceMap (LogAnalyticse Workspace) to ITSM",
                            "publishContentLink": {
                                "uri": "[concat('https://www.PowerShellGallery.com/api/v2/items/psscript/package/',variables('Runbooks').SynAzSM.Name,'/',variables('Runbooks').SynAzSM.Version, '/',variables('Runbooks').SynAzSM.Name,'.ps1')]",
                                "version": "[variables('Runbooks').SynAzSM.Version]"
                            }
                        }
                    },
                    {
                        "condition": "[equals(parameters('MSCloudSolutionProvider'), 'yes')]",
                        "name": "[concat(parameters('accountName'), '/',variables('Runbooks').SynCloudProv.Name)]",
                        "type": "Microsoft.Automation/automationAccounts/runbooks",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "location": "[resourceGroup().location]",
                        "properties": {
                            "runbookType": "PowerShell",
                            "logProgress": true,
                            "logVerbose": false,
                            "description": "Created by Provance Cloud Connector deployment. Sync Microsoft CSP (Cloud Provider) to ITSM",
                            "publishContentLink": {
                                "uri": "[concat('https://www.PowerShellGallery.com/api/v2/items/psscript/package/',variables('Runbooks').SynCloudProv.Name,'/',variables('Runbooks').SynCloudProv.Version, '/',variables('Runbooks').SynCloudProv.Name,'.ps1')]",
                                "version": "[variables('Runbooks').SynCloudProv.Version]"
                            }
                        }
                    }
                ]
            }
        }
    },
    {
        "apiVersion": "2017-05-10",
        "name": "DefaultSchedules",
        "type": "Microsoft.Resources/deployments",
        "dependsOn": [
            "[resourceId('Microsoft.Automation/automationAccounts', parameters('accountName'))]"
        ],
        "properties": {
            "mode": "Incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentVersion": "9.2.0.0",
                "resources": [
                    {
                        "type": "Microsoft.Automation/automationAccounts/schedules",
                        "name": "[concat(parameters('accountName'), '/', 'PCC-AzureSubscription-Default')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "scale": null,
                        "properties": {
                            "description": "Default Azure Subscription Sync Schedule - Created by Provance PCC Setup Script",
                            "startTime": "[parameters('SchedSubStartTime')]",
                            "expiryTime": "9999-12-31T23:59:00+00:00",
                            "interval": 4,
                            "frequency": "Hour",
                            "timeZone": "UTC"
                        }
                    },
                    {
                        "type": "Microsoft.Automation/automationAccounts/schedules",
                        "name": "[concat(parameters('accountName'), '/', 'PCC-AzureCompute-Default')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "scale": null,
                        "properties": {
                            "description": "Default Azure Compute Sync Schedule - Created by Provance PCC Setup Script",
                            "startTime": "[parameters('SchedComputeStartTime')]",
                            "expiryTime": "9999-12-31T23:59:00+00:00",
                            "interval": 4,
                            "frequency": "Hour",
                            "timeZone": "UTC"
                        }
                    },
                    {
                        "type": "Microsoft.Automation/automationAccounts/schedules",
                        "name": "[concat(parameters('accountName'), '/', 'PCC-AzureServiceMap-Default')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "scale": null,
                        "properties": {
                            "description": "Default Azure ServiceMaps Sync Schedule - Created by Provance PCC Setup Script",
                            "startTime": "[parameters('SchedServMapStartTime')]",
                            "expiryTime": "9999-12-31T23:59:00+00:00",
                            "interval": 4,
                            "frequency": "Hour",
                            "timeZone": "UTC"
                        }
                    },
                    {
                        "condition": "[equals(parameters('MSCloudSolutionProvider'), 'yes')]",
                        "type": "Microsoft.Automation/automationAccounts/schedules",
                        "name": "[concat(parameters('accountName'), '/', 'PCC-CloudProvider-Default')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "scale": null,
                        "properties": {
                            "description": "Default Cloud Provider Sync Schedule - Created by Provance PCC Setup Script",
                            "startTime": "[parameters('SchedCloudProvStartTime')]",
                            "expiryTime": "9999-12-31T23:59:00+00:00",
                            "interval": 1,
                            "frequency": "Hour",
                            "timeZone": "UTC"
                        }
                    }
                ]
            }
        }
    },
    {
        "apiVersion": "2017-05-10",
        "name": "ConnectionTypes",
        "type": "Microsoft.Resources/deployments",
        "dependsOn": [
            "[resourceId('Microsoft.Automation/automationAccounts', parameters('accountName'))]"
        ],
        "properties": {
            "mode": "Incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentVersion": "9.2.0.0",
                "resources": [
                    {
                        "name": "[concat(parameters('accountName'), '/', 'PCC-Azure-AutomationAccount')]",
                        "type": "Microsoft.Automation/automationAccounts/connectionTypes",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "isGlobal": false,
                            "fieldDefinitions": {
                                "AARGName": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of the ResourceGroup of the target Azure Automation Account"
                                    }
                                },
                                "AAName": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of the target Azure Automation Account"
                                    }
                                },
                                "ApplicationId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of the AppID to connect to the Azure Automation Account"
                                    }
                                },
                                "ApplicationKey": {
                                    "isEncrypted": true,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the AppKey for the AppID to connect to the target Azure Automation Account"
                                    }
                                },
                                "TenantId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the GUID or the Tenant, the Azure Azure Automation Account, is installed"
                                    }
                                },
                                "TenantFQDN": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the Full Qualified Name of the Tenant of the target Azure Automation Account"
                                    }
                                },
                                "SubscriptionId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the GUID of Subscription of the target Azure Automation Account"
                                    }
                                },
                                "SubscriptionName": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of Subscription of the target Azure Automation Account"
                                    }
                                },
                                "APIVersion": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the API-Version to use for the target Azure Automation Account"
                                    }
                                }
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/', 'PCC-Azure-LogAnalyticsWorkspace')]",
                        "type": "Microsoft.Automation/automationAccounts/connectionTypes",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "isGlobal": false,
                            "fieldDefinitions": {
                                "OMSWorkspace": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of the LogAnalytics Workspace"
                                    }
                                },
                                "OMSRGName": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of the Resource Group where the LogAnalytics Workspace is deployed"
                                    }
                                },
                                "TenantId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the GUID of Tenant where the LogAnalytics Workspace is deployed"
                                    }
                                },
                                "SubscriptionId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the GUID of Subscription where the LogAnalytics Workspace is deployed"
                                    }
                                },
                                "ApplicationId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of the AppID to connect to the LogAnalytics Workspace"
                                    }
                                },
                                "ApplicationKey": {
                                    "isEncrypted": true,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the AppKey for the AppID to connect to the LogAnalytics Workspace"
                                    }
                                },
                                "APIVersion": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the API-Version to use for the target Azure Automation Account"
                                    }
                                }
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/', 'PCC-Azure-Subscription')]",
                        "type": "Microsoft.Automation/automationAccounts/connectionTypes",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "isGlobal": false,
                            "fieldDefinitions": {
                                "TenantId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the GUID or the Tenant of the subscription"
                                    }
                                },
                                "TenantName": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the Full Qualified Name of the tenant of the subscription"
                                    }
                                },
                                "TenantFQDN": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the Full Qualified Name of the tenant of the subscription"
                                    }
                                },
                                "SubscriptionName": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of Subscription"
                                    }
                                },
                                "SubscriptionId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the GUID of Subscription"
                                    }
                                },
                                "ApplicationId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of the AppID to connect to the Subscription"
                                    }
                                },
                                "ApplicationKey": {
                                    "isEncrypted": true,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the AppKey for the AppID to connect to Subscription"
                                    }
                                },
                                "APIVersion": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the API-Version to use for the Subscription"
                                    }
                                }
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/', 'PCC-Provance-ITSM')]",
                        "type": "Microsoft.Automation/automationAccounts/connectionTypes",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "isGlobal": false,
                            "fieldDefinitions": {
                                "InstanceURL": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the Instance URL of the Dynamics365/ProvanceITSM instance"
                                    }
                                },
                                "UserName": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the username of the user to connect to the Provance ITSM Instance"
                                    }
                                },
                                "Password": {
                                    "isEncrypted": true,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the password of the user to connect to the Provance ITSM Instance"
                                    }
                                },
                                "TenantId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the GUID or the Tenant of the Provance ITSM Instance"
                                    }
                                },
                                "ApplicationID": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "defaultValue": "1950a258-227b-4e31-a9cf-717495945fc2",
                                    "metadata": {
                                        "description": "HardCoded PowerShell ID 1950a258-227b-4e31-a9cf-717495945fc2"
                                    }
                                },
                                "APIVersion": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the API-Version for the ITSM instance, typically v9.0"
                                    }
                                }
                            }
                        }
                    },
                    {
                        "name": "[concat(parameters('accountName'), '/', 'PCC-Azure-Compute')]",
                        "type": "Microsoft.Automation/automationAccounts/connectionTypes",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "isGlobal": false,
                            "fieldDefinitions": {
                                "TenantId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the GUID or the Tenant of the subscription of the Compute resources"
                                    }
                                },
                                "SubscriptionId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the GUID or the Subscription of the Compute resources"
                                    }
                                },
                                "ApplicationId": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the name of the AppID to connect to the Subscription"
                                    }
                                },
                                "ApplicationKey": {
                                    "isEncrypted": true,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the AppKey for the AppID to connect to Subscription"
                                    }
                                },
                                "APIVersionARMVM": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the API-Version for the ARM based Compute Resources"
                                    }
                                },
                                "APIVersionClassicVM": {
                                    "isEncrypted": false,
                                    "isOptional": false,
                                    "type": "System.String",
                                    "metadata": {
                                        "description": "Enter the API-Version for the Classic based Compute Resources"
                                    }
                                }
                            }
                        }
                    },
                    {
                        "condition": "[equals(parameters('MSCloudSolutionProvider'), 'yes')]",
                        "name": "[concat(parameters('accountName'), '/', 'PCC-Microsoft-CSP')]",
                        "type": "Microsoft.Automation/automationAccounts/connectionTypes",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "isGlobal": false,
                          "fieldDefinitions": {
                            "TenantId": {
                              "isEncrypted": false,
                              "isOptional": false,
                              "type": "System.String",
                              "metadata": {
                                "description": "Enter the GUID or the Tenant of the MS Cloud Solution Provider Tenant"
                              }
                            },
                            "ApplicationId": {
                              "isEncrypted": false,
                              "isOptional": false,
                              "type": "System.String",
                              "metadata": {
                                "description": "Enter the name of the AppId of the Cloud Solution Provider Portal"
                              }
                            },
                            "ApplicationKey": {
                              "isEncrypted": false,
                              "isOptional": true,
                              "type": "System.String",
                              "metadata": {
                                "description": "Enter the Key of the registered Cloud Solution Provider application"
                              }
                            },
                            "UserName": {
                              "isEncrypted": false,
                              "isOptional": true,
                              "type": "System.String",
                              "metadata": {
                                "description": "Enter the Username to connect to the Cloud Solution Provider Portal"
                              }
                            },
                            "Password": {
                              "isEncrypted": true,
                              "isOptional": true,
                              "type": "System.String",
                              "metadata": {
                                "description": "Enter the Password of the Username to connect to the Cloud Solution Provider Portal"
                              }
                            },
                            "BaseURL": {
                              "isEncrypted": false,
                              "isOptional": false,
                              "type": "System.String",
                              "metadata": {
                                "description": "Enter the Base URL of the Cloud Solution Provider Portal (https://api.partnercenter.microsoft.com)"
                              }
                            },
                            "Resource": {
                              "isEncrypted": false,
                              "isOptional": false,
                              "type": "System.String",
                              "metadata": {
                                "description": "Enter the Resource URL of the Cloud Solution Provider Portal (https://api.partnercenter.microsoft.com)"
                              }
                            },
                            "LoginURL": {
                              "isEncrypted": false,
                              "isOptional": false,
                              "type": "System.String",
                              "metadata": {
                                "description": "Enter the Login URL for authentication (https://login.microsoftonline.com)"
                              }
                            },
                            "APIVersion": {
                              "isEncrypted": false,
                              "isOptional": false,
                              "type": "System.String",
                              "metadata": {
                                "description": "Enter the API-Version of the CSP REST-API (1.0)"
                              }
                            }
                          }
                        }
                    }
                ]
            }
        }
    },
    {
        "apiVersion": "2017-05-10",
        "name": "ThisConnections",
        "type": "Microsoft.Resources/deployments",
        "dependsOn": [
            "[resourceId('Microsoft.Resources/deployments', 'ConnectionTypes')]"
        ],
        "properties": {
            "mode": "Incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentVersion": "9.2.0.0",
                "resources": [
                    {
                        "type": "Microsoft.Automation/automationAccounts/connections",
                        "name": "[concat(parameters('accountName'), '/', 'ThisSubscription')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "description": "Self referential Connection to this Azure Subscription",
                            "connectionType": {
                                "name": "PCC-Azure-Subscription"
                            },
                            "fieldDefinitionValues": {
                                "TenantId": "[subscription().tenantId]",
                                "TenantName": "[parameters('TenantFQDN')]",
                                "TenantFQDN": "[parameters('TenantFQDN')]",
                                "SubscriptionId": "[subscription().subscriptionId]",
                                "SubscriptionName": "[subscription().displayName]",
                                "ApplicationId": "[parameters('ApplicationId')]",
                                "ApplicationKey": "[parameters('ApplicationKey')]",
                                "APIVersion": "2016-06-01"
                            }
                        }
                    },
                    {
                        "type": "Microsoft.Automation/automationAccounts/connections",
                        "name": "[concat(parameters('accountName'), '/', 'ThisAutomationAccount')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "description": "Self referential Connection to this Automation Account for self-management",
                            "connectionType": {
                                "name": "PCC-Azure-AutomationAccount"
                            },
                            "fieldDefinitionValues": {
                                "AARGName": "[resourceGroup().Name]",
                                "AAName": "[parameters('accountName')]",
                                "ApplicationId": "[parameters('ApplicationId')]",
                                "ApplicationKey": "[parameters('ApplicationKey')]",
                                "TenantId": "[subscription().tenantId]",
                                "TenantFQDN": "[parameters('TenantFQDN')]",
                                "SubscriptionId": "[subscription().subscriptionId]",
                                "SubscriptionName": "[subscription().displayName]",
                                "APIVersion": "[variables('AAAPIVersion')]"
                            }
                        }
                    }
                ]
            }
        }
    },
    {
        "apiVersion": "2017-05-10",
        "name": "ExampleConnections",
        "type": "Microsoft.Resources/deployments",
        "dependsOn": [
            "[resourceId('Microsoft.Resources/deployments', 'ConnectionTypes')]"
        ],
        "properties": {
            "mode": "Incremental",
            "template": {
                "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                "contentVersion": "9.2.0.0",
                "resources": [
                    {
                        "condition": "[equals(parameters('CreateSampleConnections'), 'yes')]",
                        "type": "Microsoft.Automation/automationAccounts/connections",
                        "name": "[concat(parameters('accountName'), '/', 'EXAMPLE PCC-Provance-ITSM')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "description": "Example connection for a Provance ITSM Instance with example values. Note: The ApplicationID is a hardcoded ID that must not be changes and is similar to all Dynamics365/ProvanceITSM instances",
                            "connectionType": {
                                "name": "PCC-Provance-ITSM"
                            },
                            "fieldDefinitionValues": {
                                "InstanceURL": "https://youritsm.crm11.dynamics.com",
                                "UserName": "UserwithAdminPriviledges@youritsm.onmicrosoft.com",
                                "Password": "TheSecretPassword",
                                "Tenantid": "00000000-0000-0000-0000-000000000000",
                                "ApplicationID": "1950a258-227b-4e31-a9cf-717495945fc2",
                                "APIVersion": "v9.0"
                            }
                        }
                    },
                    {
                        "condition": "[equals(parameters('CreateSampleConnections'), 'yes')]",
                        "type": "Microsoft.Automation/automationAccounts/connections",
                        "name": "[concat(parameters('accountName'), '/', 'EXAMPLE PCC-Azure-LogAnalyticsWorkspace')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "description": "Example connection for an Azure Subscription with example values",
                            "connectionType": {
                                "name": "PCC-Azure-LogAnalyticsWorkspace"
                            },
                            "fieldDefinitionValues": {
                                "TenantId": "00000000-0000-0000-0000-000000000000",
                                "SubscriptionId": "00000000-0000-0000-0000-000000000000",
                                "ApplicationId": "00000000-0000-0000-0000-000000000000",
                                "ApplicationKey": "XY6q6hgikA5gu33tmF+DEgXD4K9B0UTP6LxColZ1bd0=",
                                "OMSWorkspace": "Your LogAnalytics Workspace Name",
                                "OMSRGName": "Name of the Resource Group the LogAnalytics Workspace is installed",
                                "APIVersion": "2015-11-01-preview"
                            }
                        }
                    },
                    {
                        "condition": "[equals(parameters('CreateSampleConnections'), 'yes')]",
                        "type": "Microsoft.Automation/automationAccounts/connections",
                        "name": "[concat(parameters('accountName'), '/', 'EXAMPLE PCC-Azure-Compute')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "descripton": "Example connection for an Azure Subscription with example values",
                            "connectionType": {
                                "name": "PCC-Azure-Compute"
                            },
                            "fieldDefinitionValues": {
                                "TenantId": "00000000-0000-0000-0000-000000000000",
                                "SubscriptionId": "00000000-0000-0000-0000-000000000000",
                                "ApplicationId": "00000000-0000-0000-0000-000000000000",
                                "ApplicationKey": "XY6q6hgikA5gu33tmF+DEgXD4K9B0UTP6LxColZ1bd0=",
                                "APIVersionARMVM": "2017-12-01",
                                "APIVersionClassicVM": "2016-04-01"
                            }
                        }
                    },
                    {
                        "condition": "[and(equals(parameters('MSCloudSolutionProvider'),'yes'),equals(parameters('CreateSampleConnections'), 'yes'))]",
                        "type": "Microsoft.Automation/automationAccounts/connections",
                        "name": "[concat(parameters('accountName'), '/', 'EXAMPLE PCC-Microsoft-CSP')]",
                        "apiVersion": "[variables('AAAPIVersion')]",
                        "properties": {
                            "descripton": "Example connection for a Microsoft CSP Portal Connection with example values",
                            "connectionType": {
                                "name": "PCC-Microsoft-CSP"
                            },
                            "fieldDefinitionValues": {
                                "TenantId": "00000000-0000-0000-0000-000000000000",
                                "ApplicationId": "00000000-0000-0000-0000-000000000000",
                                "ApplicationKey": "longsecretkeyyougotbycreatingthisappkey",
                                "UserName": "user@yourcspdomain.onmicrosoft.com",
                                "Password": "Password for the above user",
                                "BaseURL": "https://api.partnercenter.microsoft.com",
                                "Resource": "https://api.partnercenter.microsoft.com",
                                "LoginURL": "https://login.microsoftonline.com",
                                "APIVersion": "1.0"
                            }
                        }
                    }
                ]
            }
        }
    }
],
"outputs": {}
}