From 3900ec51693e9ab3af81bc543e6092085f00df00 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Fri, 10 Jan 2025 11:35:33 -0500 Subject: [PATCH 01/29] fix links in offcanvas --- .../CippComponents/CippTenantSelector.jsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/CippComponents/CippTenantSelector.jsx b/src/components/CippComponents/CippTenantSelector.jsx index 5042aefabce7..b7299ceee8df 100644 --- a/src/components/CippComponents/CippTenantSelector.jsx +++ b/src/components/CippComponents/CippTenantSelector.jsx @@ -77,6 +77,11 @@ export const CippTenantSelector = (props) => { ? { value: tenant, label: `${matchingTenant.displayName} (${tenant})`, + addedFields: { + defaultDomainName: matchingTenant.defaultDomainName, + displayName: matchingTenant.displayName, + customerId: matchingTenant.customerId, + }, } : { value: null, @@ -183,7 +188,7 @@ export const CippTenantSelector = (props) => { actions={[ { label: "M365 Admin Portal", - link: `https://admin.microsoft.com/Partner/BeginClientSession.aspx?CTID=${currentTenant?.value}&CSDEST=o365admincenter`, + link: `https://admin.microsoft.com/Partner/BeginClientSession.aspx?CTID=${currentTenant?.addedFields?.customerId}&CSDEST=o365admincenter`, icon: , }, { @@ -213,17 +218,17 @@ export const CippTenantSelector = (props) => { }, { label: "Sharepoint Portal", - link: `https://admin.microsoft.com/Partner/beginclientsession.aspx?CTID=${currentTenant?.value}&CSDEST=SharePoint`, + link: `https://admin.microsoft.com/Partner/beginclientsession.aspx?CTID=${currentTenant?.addedFields?.customerId}&CSDEST=SharePoint`, icon: , }, { label: "Security Portal", - link: `https://security.microsoft.com/?tid=${currentTenant?.value}`, + link: `https://security.microsoft.com/?tid=${currentTenant?.addedFields?.customerId}`, icon: , }, { label: "Compliance Portal", - link: `https://compliance.microsoft.com/?tid=${currentTenant?.value}`, + link: `https://compliance.microsoft.com/?tid=${currentTenant?.addedFields?.customerId}`, icon: , }, ]} From 9bc082bd3b6adb944f9fe0f4aa5c8b47cb6a023e Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Fri, 10 Jan 2025 17:53:39 +0100 Subject: [PATCH 02/29] Add files via upload --- deployment/AzureDeploymentTemplate.json | 247 +++++++++++++ ...AzureDeploymentTemplate_regionoptions.json | 247 +++++++++++++ deployment/DevAzureDeploymentTemplate.json | 334 ++++++++++++++++++ ...AzureDeploymentTemplate_regionoptions.json | 334 ++++++++++++++++++ 4 files changed, 1162 insertions(+) create mode 100644 deployment/AzureDeploymentTemplate.json create mode 100644 deployment/AzureDeploymentTemplate_regionoptions.json create mode 100644 deployment/DevAzureDeploymentTemplate.json create mode 100644 deployment/DevAzureDeploymentTemplate_regionoptions.json diff --git a/deployment/AzureDeploymentTemplate.json b/deployment/AzureDeploymentTemplate.json new file mode 100644 index 000000000000..aa445e3fd6c8 --- /dev/null +++ b/deployment/AzureDeploymentTemplate.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "defaultValue": "CIPP", + "type": "string", + "metadata": { + "description": "Name use as base-template to named the resources deployed in Azure." + } + }, + "GithubRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP", + "type": "string", + "metadata": { + "description": "URL to your Github Frontend fork." + } + }, + "GithubToken": { + "defaultValue": "GeneratedPassword", + "type": "string", + "metadata": { + "description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token" + } + } + }, + "variables": { + "suffix": "[substring(toLower(uniqueString(resourceGroup().id, resourceGroup().location)),0,5)]", + "funcAppName": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "funcStorageName": "[tolower(concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),16)), 'stg', variables('suffix')))]", + "serverFarmName": "[concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),14)), '-srv-', variables('suffix'))]", + "uniqueResourceNameBase": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "swaName": "[toLower(concat(parameters('baseName'), '-swa-', variables('suffix')))]" + }, + "resources": [ + { + "type": "Microsoft.KeyVault/vaults", + "name": "[variables('uniqueResourceNameBase')]", + "apiVersion": "2016-10-01", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "family": "A", + "name": "standard" + }, + "tenantId": "[subscription().tenantid]", + "accessPolicies": [ + { + "tenantId": "[subscription().tenantid]", + "objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]", + "permissions": { + "keys": [], + "secrets": [ "all" ], + "certificates": [] + } + } + ], + "enabledForDeployment": true, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": true + }, + "resources": [ + { + "type": "secrets", + "name": "applicationid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "LongApplicationId" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "applicationsecret", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "AppSecret" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "refreshtoken", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "RefreshToken" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "tenantid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "tenantId" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + } + ], + "dependsOn": [ "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" ] + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "identity": { + "type": "SystemAssigned" + }, + "name": "[variables('funcAppName')]", + "location": "[resourceGroup().location]", + "kind": "functionapp", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms',variables('serverFarmName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('funcStorageName'))]" + ], + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]", + "siteConfig": { + "Use32BitWorkerProcess": false, + "powerShellVersion": "7.4", + "appSettings": [ + { + "name": "AzureWebJobsStorage", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTSHARE", + "value": "[variables('funcAppName')]" + }, + { + "name": "FUNCTIONS_EXTENSION_VERSION", + "value": "~4" + }, + { + "name": "WEBSITE_RUN_FROM_PACKAGE", + "value": "1" + }, + { + "name": "FUNCTIONS_WORKER_RUNTIME", + "value": "powershell" + } + ] + } + } + }, + { + "name": "[concat(variables('funcAppName'), '/ZipDeploy')]", + "type": "Microsoft.Web/sites/extensions", + "apiVersion": "2021-02-01", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" + ], + "properties": { + "packageUri": "https://cippreleases.blob.core.windows.net/cipp-api/latest.zip" + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-07-01", + "name": "[variables('funcStorageName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "funcStorageName" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2018-02-01", + "name": "[variables('serverFarmName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Y1", + "tier": "Dynamic", + "size": "Y1", + "family": "Y", + "capacity": 0 + }, + "properties": { + "perSiteScaling": false, + "maximumElasticWorkerCount": 1, + "isSpot": false, + "reserved": false, + "isXenon": false, + "hyperV": false, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "name": "[variables('serverFarmName')]", + "computeMode": "Dynamic" + } + }, + { + "type": "Microsoft.Web/staticSites", + "apiVersion": "2021-01-15", + "name": "[variables('swaName')]", + "location": "[resourceGroup().location]", + "properties": { + "repositoryUrl": "[parameters('GithubRepository')]", + "branch": "main", + "repositoryToken": "[parameters('GithubToken')]", + "buildProperties": { + "appLocation": "/", + "apiLocation": "", + "appArtifactLocation": "" + } + }, + "sku": { + "name": "Standard", + "tier": "Standard" + } + }, + { + "type": "Microsoft.Web/staticSites/userProvidedFunctionApps", + "apiVersion": "2020-12-01", + "name": "[concat(variables('swaName'), '/', variables('swaName'))]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "functionAppResourceId": "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]", + "functionAppRegion": "[resourceGroup().location]" + } + } + ], + "outputs": {} +} diff --git a/deployment/AzureDeploymentTemplate_regionoptions.json b/deployment/AzureDeploymentTemplate_regionoptions.json new file mode 100644 index 000000000000..1abff7bcc162 --- /dev/null +++ b/deployment/AzureDeploymentTemplate_regionoptions.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "defaultValue": "CIPP", + "type": "string", + "metadata": { + "description": "Name used as base-template to name the resources deployed in Azure." + } + }, + "GithubRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP", + "type": "string", + "metadata": { + "description": "URL to your Github Frontend fork." + } + }, + "GithubToken": { + "defaultValue": "GeneratedPassword", + "type": "string", + "metadata": { + "description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token)" + } + } + }, + "variables": { + "suffix": "[substring(toLower(uniqueString(resourceGroup().id, resourceGroup().location)),0,5)]", + "funcAppName": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "funcStorageName": "[tolower(concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),16)), 'stg', variables('suffix')))]", + "serverFarmName": "[concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),14)), '-srv-', variables('suffix'))]", + "uniqueResourceNameBase": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "swaName": "[toLower(concat(parameters('baseName'), '-swa-', variables('suffix')))]" + }, + "resources": [ + { + "type": "Microsoft.KeyVault/vaults", + "name": "[variables('uniqueResourceNameBase')]", + "apiVersion": "2016-10-01", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "family": "A", + "name": "standard" + }, + "tenantId": "[subscription().tenantid]", + "accessPolicies": [ + { + "tenantId": "[subscription().tenantid]", + "objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]", + "permissions": { + "keys": [], + "secrets": [ "all" ], + "certificates": [] + } + } + ], + "enabledForDeployment": true, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": true + }, + "resources": [ + { + "type": "secrets", + "name": "applicationid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "LongApplicationId" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "applicationsecret", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "AppSecret" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "refreshtoken", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "RefreshToken" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "tenantid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "tenantId" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + } + ], + "dependsOn": [ "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" ] + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "identity": { + "type": "SystemAssigned" + }, + "name": "[variables('funcAppName')]", + "location": "[resourceGroup().location]", + "kind": "functionapp", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms',variables('serverFarmName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('funcStorageName'))]" + ], + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]", + "siteConfig": { + "Use32BitWorkerProcess": false, + "powerShellVersion": "7.4", + "appSettings": [ + { + "name": "AzureWebJobsStorage", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTSHARE", + "value": "[variables('funcAppName')]" + }, + { + "name": "FUNCTIONS_EXTENSION_VERSION", + "value": "~4" + }, + { + "name": "WEBSITE_RUN_FROM_PACKAGE", + "value": "1" + }, + { + "name": "FUNCTIONS_WORKER_RUNTIME", + "value": "powershell" + } + ] + } + } + }, + { + "name": "[concat(variables('funcAppName'), '/ZipDeploy')]", + "type": "Microsoft.Web/sites/extensions", + "apiVersion": "2021-02-01", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" + ], + "properties": { + "packageUri": "https://cippreleases.blob.core.windows.net/cipp-api/latest.zip" + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-07-01", + "name": "[variables('funcStorageName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "funcStorageName" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2018-02-01", + "name": "[variables('serverFarmName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Y1", + "tier": "Dynamic", + "size": "Y1", + "family": "Y", + "capacity": 0 + }, + "properties": { + "perSiteScaling": false, + "maximumElasticWorkerCount": 1, + "isSpot": false, + "reserved": false, + "isXenon": false, + "hyperV": false, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "name": "[variables('serverFarmName')]", + "computeMode": "Dynamic" + } + }, + { + "type": "Microsoft.Web/staticSites", + "apiVersion": "2021-01-15", + "name": "[variables('swaName')]", + "location": "centralus", + "properties": { + "repositoryUrl": "[parameters('GithubRepository')]", + "branch": "main", + "repositoryToken": "[parameters('GithubToken')]", + "buildProperties": { + "appLocation": "/", + "apiLocation": "", + "appArtifactLocation": "" + } + }, + "sku": { + "name": "Standard", + "tier": "Standard" + } + }, + { + "type": "Microsoft.Web/staticSites/userProvidedFunctionApps", + "apiVersion": "2020-12-01", + "name": "[concat(variables('swaName'), '/', variables('swaName'))]", + "location": "centralus", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "functionAppResourceId": "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]", + "functionAppRegion": "[resourceGroup().location]" + } + } + ], + "outputs": {} +} diff --git a/deployment/DevAzureDeploymentTemplate.json b/deployment/DevAzureDeploymentTemplate.json new file mode 100644 index 000000000000..5e6077beab41 --- /dev/null +++ b/deployment/DevAzureDeploymentTemplate.json @@ -0,0 +1,334 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "defaultValue": "CIPPDev", + "type": "string", + "metadata": { + "description": "Name used as base-template to name the resources deployed in Azure." + } + }, + "TenantID": { + "defaultValue": "YourTenant.onmicrosoft.com", + "type": "string", + "metadata": { + "description": "Your tenant ID" + } + }, + "ApplicationID": { + "defaultValue": "LongApplicationID", + "type": "string", + "metadata": { + "description": "The Application ID for your Secure Application Model" + } + }, + "ApplicationSecret": { + "defaultValue": "LongApplicationSecret", + "type": "string", + "metadata": { + "description": "The Application Secret for your Secure Application Model." + } + }, + "Refreshtoken": { + "defaultValue": "LongRefreshtoken", + "type": "string", + "metadata": { + "description": "The Refresh token for your Secure Application Model." + } + }, + "GithubRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP", + "type": "string", + "metadata": { + "description": "URL to your Github Frontend fork." + } + }, + "GithubToken": { + "defaultValue": "GeneratedPassword", + "type": "string", + "metadata": { + "description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token)" + } + }, + "GithubAPIRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP-API", + "type": "string", + "metadata": { + "description": "URL to your Github backend fork." + } + } + }, + "variables": { + "suffix": "[substring(toLower(uniqueString(resourceGroup().id, resourceGroup().location)),0,5)]", + "funcAppName": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "funcStorageName": "[tolower(concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),16)), 'stg', variables('suffix')))]", + "serverFarmName": "[concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),14)), '-srv-', variables('suffix'))]", + "uniqueResourceNameBase": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "swaName": "[toLower(concat(parameters('baseName'), '-swa-', variables('suffix')))]" + }, + "resources": [ + { + "type": "Microsoft.KeyVault/vaults", + "name": "[variables('uniqueResourceNameBase')]", + "apiVersion": "2016-10-01", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "family": "A", + "name": "standard" + }, + "tenantId": "[subscription().tenantid]", + "accessPolicies": [ + { + "tenantId": "[subscription().tenantid]", + "objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]", + "permissions": { + "keys": [], + "secrets": ["all"], + "certificates": [] + } + } + ], + "enabledForDeployment": true, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": true + }, + "resources": [ + { + "type": "secrets", + "name": "applicationid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('ApplicationID')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "applicationsecret", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('Applicationsecret')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "refreshtoken", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('refreshtoken')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "tenantid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('tenantid')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + } + ], + "dependsOn": ["[resourceId('Microsoft.Web/sites', variables('funcAppName'))]"] + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "identity": { + "type": "SystemAssigned" + }, + "name": "[variables('funcAppName')]", + "location": "[resourceGroup().location]", + "kind": "functionapp", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms',variables('serverFarmName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('funcStorageName'))]" + ], + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]", + "siteConfig": { + "Use32BitWorkerProcess": false, + "powerShellVersion": "7.2", + "appSettings": [ + { + "name": "AzureWebJobsStorage", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTSHARE", + "value": "[variables('funcAppName')]" + }, + { + "name": "FUNCTIONS_EXTENSION_VERSION", + "value": "~4" + }, + { + "name": "ApplicationID", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationId)')]" + }, + { + "name": "ApplicationSecret", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationSecret)')]" + }, + { + "name": "RefreshToken", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/RefreshToken)')]" + }, + { + "name": "TenantID", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/tenantid)')]" + }, + { + "name": "FUNCTIONS_WORKER_RUNTIME", + "value": "powershell" + }, + { + "name": "WEBSITE_RUN_FROM_PACKAGE", + "value": "1" + } + ] + } + }, + "resources": [ + { + "apiVersion": "2015-08-01", + "name": "web", + "type": "sourcecontrols", + "dependsOn": ["[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]"], + "properties": { + "RepoUrl": "[parameters('GithubAPIRepository')]", + "repositoryToken": "[parameters('GithubToken')]", + "branch": "master", + "publishRunbook": true, + "gitHubActionConfiguration": { + "codeConfiguration": null, + "containerConfiguration": null, + "isLinux": false, + "generateWorkflowFile": true, + "workflowSettings": { + "appType": "functionapp", + "publishType": "code", + "os": "windows", + "variables": { + "runtimeVersion": "7.2", + "sitename": "[variables('funcAppName')]", + "slotname": "Production", + "publishingprofilesecretname": "[variables('funcAppName')]", + "branch": "master" + }, + "runtimeStack": "powershell", + "workflowApiVersion": "2020-12-01", + "useCanaryFusionServer": false + } + } + } + } + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-07-01", + "name": "[variables('funcStorageName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "funcStorageName" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2018-02-01", + "name": "[variables('serverFarmName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Y1", + "tier": "Dynamic", + "size": "Y1", + "family": "Y", + "capacity": 0 + }, + "properties": { + "perSiteScaling": false, + "maximumElasticWorkerCount": 1, + "isSpot": false, + "reserved": false, + "isXenon": false, + "hyperV": false, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "name": "[variables('serverFarmName')]", + "computeMode": "Dynamic" + } + }, + { + "type": "Microsoft.Web/staticSites", + "apiVersion": "2021-01-15", + "name": "[variables('swaName')]", + "location": "[resourceGroup().location]", + "properties": { + "repositoryUrl": "[parameters('GithubRepository')]", + "branch": "dev", + "repositoryToken": "[parameters('GithubToken')]", + "buildProperties": { + "appLocation": "/", + "apiLocation": "", + "appArtifactLocation": "" + } + }, + "sku": { + "name": "Standard", + "tier": "Standard" + } + }, + { + "type": "Microsoft.Web/staticSites/userProvidedFunctionApps", + "apiVersion": "2020-12-01", + "name": "[concat(variables('swaName'), '/', variables('swaName'))]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "functionAppResourceId": "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]", + "functionAppRegion": "[resourceGroup().location]" + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2018-09-01-preview", + "name": "[guid(variables('funcAppName'))]", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "roleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')]", + "principalId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]" + } + } + ], + "outputs": {} +} diff --git a/deployment/DevAzureDeploymentTemplate_regionoptions.json b/deployment/DevAzureDeploymentTemplate_regionoptions.json new file mode 100644 index 000000000000..f41e669076e5 --- /dev/null +++ b/deployment/DevAzureDeploymentTemplate_regionoptions.json @@ -0,0 +1,334 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "defaultValue": "CIPP", + "type": "string", + "metadata": { + "description": "Name used as base-template to name the resources deployed in Azure." + } + }, + "TenantID": { + "defaultValue": "YourTenant.onmicrosoft.com", + "type": "string", + "metadata": { + "description": "Your tenant ID" + } + }, + "ApplicationID": { + "defaultValue": "LongApplicationID", + "type": "string", + "metadata": { + "description": "The Application ID for your Secure Application Model" + } + }, + "ApplicationSecret": { + "defaultValue": "LongApplicationSecret", + "type": "string", + "metadata": { + "description": "The Application Secret for your Secure Application Model." + } + }, + "Refreshtoken": { + "defaultValue": "LongRefreshtoken", + "type": "string", + "metadata": { + "description": "The Refresh token for your Secure Application Model." + } + }, + "GithubRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP", + "type": "string", + "metadata": { + "description": "URL to your Github Frontend fork." + } + }, + "GithubToken": { + "defaultValue": "GeneratedPassword", + "type": "string", + "metadata": { + "description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token)" + } + }, + "GithubAPIRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP-API", + "type": "string", + "metadata": { + "description": "URL to your Github backend fork." + } + } + }, + "variables": { + "suffix": "[substring(toLower(uniqueString(resourceGroup().id, resourceGroup().location)),0,5)]", + "funcAppName": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "funcStorageName": "[tolower(concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),16)), 'stg', variables('suffix')))]", + "serverFarmName": "[concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),14)), '-srv-', variables('suffix'))]", + "uniqueResourceNameBase": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "swaName": "[toLower(concat(parameters('baseName'), '-swa-', variables('suffix')))]" + }, + "resources": [ + { + "type": "Microsoft.KeyVault/vaults", + "name": "[variables('uniqueResourceNameBase')]", + "apiVersion": "2016-10-01", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "family": "A", + "name": "standard" + }, + "tenantId": "[subscription().tenantid]", + "accessPolicies": [ + { + "tenantId": "[subscription().tenantid]", + "objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]", + "permissions": { + "keys": [], + "secrets": ["all"], + "certificates": [] + } + } + ], + "enabledForDeployment": true, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": true + }, + "resources": [ + { + "type": "secrets", + "name": "applicationid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('ApplicationID')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "applicationsecret", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('Applicationsecret')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "refreshtoken", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('refreshtoken')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "tenantid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('tenantid')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + } + ], + "dependsOn": ["[resourceId('Microsoft.Web/sites', variables('funcAppName'))]"] + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "identity": { + "type": "SystemAssigned" + }, + "name": "[variables('funcAppName')]", + "location": "[resourceGroup().location]", + "kind": "functionapp", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms',variables('serverFarmName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('funcStorageName'))]" + ], + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]", + "siteConfig": { + "Use32BitWorkerProcess": false, + "powerShellVersion": "7.2", + "appSettings": [ + { + "name": "AzureWebJobsStorage", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTSHARE", + "value": "[variables('funcAppName')]" + }, + { + "name": "FUNCTIONS_EXTENSION_VERSION", + "value": "~4" + }, + { + "name": "ApplicationID", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationId)')]" + }, + { + "name": "ApplicationSecret", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationSecret)')]" + }, + { + "name": "RefreshToken", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/RefreshToken)')]" + }, + { + "name": "TenantID", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/tenantid)')]" + }, + { + "name": "FUNCTIONS_WORKER_RUNTIME", + "value": "powershell" + }, + { + "name": "WEBSITE_RUN_FROM_PACKAGE", + "value": "1" + } + ] + } + }, + "resources": [ + { + "apiVersion": "2015-08-01", + "name": "web", + "type": "sourcecontrols", + "dependsOn": ["[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]"], + "properties": { + "RepoUrl": "[parameters('GithubAPIRepository')]", + "repositoryToken": "[parameters('GithubToken')]", + "branch": "master", + "publishRunbook": true, + "gitHubActionConfiguration": { + "codeConfiguration": null, + "containerConfiguration": null, + "isLinux": false, + "generateWorkflowFile": true, + "workflowSettings": { + "appType": "functionapp", + "publishType": "code", + "os": "windows", + "variables": { + "runtimeVersion": "7.2", + "sitename": "[variables('funcAppName')]", + "slotname": "Production", + "publishingprofilesecretname": "[variables('funcAppName')]", + "branch": "master" + }, + "runtimeStack": "powershell", + "workflowApiVersion": "2020-12-01", + "useCanaryFusionServer": false + } + } + } + } + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-07-01", + "name": "[variables('funcStorageName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "funStorageName" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2018-02-01", + "name": "[variables('serverFarmName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Y1", + "tier": "Dynamic", + "size": "Y1", + "family": "Y", + "capacity": 0 + }, + "properties": { + "perSiteScaling": false, + "maximumElasticWorkerCount": 1, + "isSpot": false, + "reserved": false, + "isXenon": false, + "hyperV": false, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "name": "[variables('serverFarmName')]", + "computeMode": "Dynamic" + } + }, + { + "type": "Microsoft.Web/staticSites", + "apiVersion": "2021-01-15", + "name": "[variables('swaName')]", + "location": "centralus", + "properties": { + "repositoryUrl": "[parameters('GithubRepository')]", + "branch": "dev", + "repositoryToken": "[parameters('GithubToken')]", + "buildProperties": { + "appLocation": "/", + "apiLocation": "", + "appArtifactLocation": "" + } + }, + "sku": { + "name": "Standard", + "tier": "Standard" + } + }, + { + "type": "Microsoft.Web/staticSites/userProvidedFunctionApps", + "apiVersion": "2020-12-01", + "name": "[concat(variables('swaName'), '/', variables('swaName'))]", + "location": "centralus", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "functionAppResourceId": "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]", + "functionAppRegion": "[resourceGroup().location]" + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2018-09-01-preview", + "name": "[guid(variables('funcAppName'))]", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "roleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')]", + "principalId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]" + } + } + ], + "outputs": {} +} From 6820ee3d52bfe32086ddcd79076d0da91154b7b9 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Fri, 10 Jan 2025 17:53:55 +0100 Subject: [PATCH 03/29] Add files via upload --- deployment/AzureDeploymentTemplate.json | 247 +++++++++++++ ...AzureDeploymentTemplate_regionoptions.json | 247 +++++++++++++ deployment/DevAzureDeploymentTemplate.json | 334 ++++++++++++++++++ ...AzureDeploymentTemplate_regionoptions.json | 334 ++++++++++++++++++ 4 files changed, 1162 insertions(+) create mode 100644 deployment/AzureDeploymentTemplate.json create mode 100644 deployment/AzureDeploymentTemplate_regionoptions.json create mode 100644 deployment/DevAzureDeploymentTemplate.json create mode 100644 deployment/DevAzureDeploymentTemplate_regionoptions.json diff --git a/deployment/AzureDeploymentTemplate.json b/deployment/AzureDeploymentTemplate.json new file mode 100644 index 000000000000..aa445e3fd6c8 --- /dev/null +++ b/deployment/AzureDeploymentTemplate.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "defaultValue": "CIPP", + "type": "string", + "metadata": { + "description": "Name use as base-template to named the resources deployed in Azure." + } + }, + "GithubRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP", + "type": "string", + "metadata": { + "description": "URL to your Github Frontend fork." + } + }, + "GithubToken": { + "defaultValue": "GeneratedPassword", + "type": "string", + "metadata": { + "description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token" + } + } + }, + "variables": { + "suffix": "[substring(toLower(uniqueString(resourceGroup().id, resourceGroup().location)),0,5)]", + "funcAppName": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "funcStorageName": "[tolower(concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),16)), 'stg', variables('suffix')))]", + "serverFarmName": "[concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),14)), '-srv-', variables('suffix'))]", + "uniqueResourceNameBase": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "swaName": "[toLower(concat(parameters('baseName'), '-swa-', variables('suffix')))]" + }, + "resources": [ + { + "type": "Microsoft.KeyVault/vaults", + "name": "[variables('uniqueResourceNameBase')]", + "apiVersion": "2016-10-01", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "family": "A", + "name": "standard" + }, + "tenantId": "[subscription().tenantid]", + "accessPolicies": [ + { + "tenantId": "[subscription().tenantid]", + "objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]", + "permissions": { + "keys": [], + "secrets": [ "all" ], + "certificates": [] + } + } + ], + "enabledForDeployment": true, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": true + }, + "resources": [ + { + "type": "secrets", + "name": "applicationid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "LongApplicationId" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "applicationsecret", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "AppSecret" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "refreshtoken", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "RefreshToken" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "tenantid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "tenantId" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + } + ], + "dependsOn": [ "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" ] + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "identity": { + "type": "SystemAssigned" + }, + "name": "[variables('funcAppName')]", + "location": "[resourceGroup().location]", + "kind": "functionapp", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms',variables('serverFarmName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('funcStorageName'))]" + ], + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]", + "siteConfig": { + "Use32BitWorkerProcess": false, + "powerShellVersion": "7.4", + "appSettings": [ + { + "name": "AzureWebJobsStorage", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTSHARE", + "value": "[variables('funcAppName')]" + }, + { + "name": "FUNCTIONS_EXTENSION_VERSION", + "value": "~4" + }, + { + "name": "WEBSITE_RUN_FROM_PACKAGE", + "value": "1" + }, + { + "name": "FUNCTIONS_WORKER_RUNTIME", + "value": "powershell" + } + ] + } + } + }, + { + "name": "[concat(variables('funcAppName'), '/ZipDeploy')]", + "type": "Microsoft.Web/sites/extensions", + "apiVersion": "2021-02-01", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" + ], + "properties": { + "packageUri": "https://cippreleases.blob.core.windows.net/cipp-api/latest.zip" + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-07-01", + "name": "[variables('funcStorageName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "funcStorageName" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2018-02-01", + "name": "[variables('serverFarmName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Y1", + "tier": "Dynamic", + "size": "Y1", + "family": "Y", + "capacity": 0 + }, + "properties": { + "perSiteScaling": false, + "maximumElasticWorkerCount": 1, + "isSpot": false, + "reserved": false, + "isXenon": false, + "hyperV": false, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "name": "[variables('serverFarmName')]", + "computeMode": "Dynamic" + } + }, + { + "type": "Microsoft.Web/staticSites", + "apiVersion": "2021-01-15", + "name": "[variables('swaName')]", + "location": "[resourceGroup().location]", + "properties": { + "repositoryUrl": "[parameters('GithubRepository')]", + "branch": "main", + "repositoryToken": "[parameters('GithubToken')]", + "buildProperties": { + "appLocation": "/", + "apiLocation": "", + "appArtifactLocation": "" + } + }, + "sku": { + "name": "Standard", + "tier": "Standard" + } + }, + { + "type": "Microsoft.Web/staticSites/userProvidedFunctionApps", + "apiVersion": "2020-12-01", + "name": "[concat(variables('swaName'), '/', variables('swaName'))]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "functionAppResourceId": "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]", + "functionAppRegion": "[resourceGroup().location]" + } + } + ], + "outputs": {} +} diff --git a/deployment/AzureDeploymentTemplate_regionoptions.json b/deployment/AzureDeploymentTemplate_regionoptions.json new file mode 100644 index 000000000000..1abff7bcc162 --- /dev/null +++ b/deployment/AzureDeploymentTemplate_regionoptions.json @@ -0,0 +1,247 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "defaultValue": "CIPP", + "type": "string", + "metadata": { + "description": "Name used as base-template to name the resources deployed in Azure." + } + }, + "GithubRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP", + "type": "string", + "metadata": { + "description": "URL to your Github Frontend fork." + } + }, + "GithubToken": { + "defaultValue": "GeneratedPassword", + "type": "string", + "metadata": { + "description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token)" + } + } + }, + "variables": { + "suffix": "[substring(toLower(uniqueString(resourceGroup().id, resourceGroup().location)),0,5)]", + "funcAppName": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "funcStorageName": "[tolower(concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),16)), 'stg', variables('suffix')))]", + "serverFarmName": "[concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),14)), '-srv-', variables('suffix'))]", + "uniqueResourceNameBase": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "swaName": "[toLower(concat(parameters('baseName'), '-swa-', variables('suffix')))]" + }, + "resources": [ + { + "type": "Microsoft.KeyVault/vaults", + "name": "[variables('uniqueResourceNameBase')]", + "apiVersion": "2016-10-01", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "family": "A", + "name": "standard" + }, + "tenantId": "[subscription().tenantid]", + "accessPolicies": [ + { + "tenantId": "[subscription().tenantid]", + "objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]", + "permissions": { + "keys": [], + "secrets": [ "all" ], + "certificates": [] + } + } + ], + "enabledForDeployment": true, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": true + }, + "resources": [ + { + "type": "secrets", + "name": "applicationid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "LongApplicationId" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "applicationsecret", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "AppSecret" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "refreshtoken", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "RefreshToken" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "tenantid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "tenantId" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + } + ], + "dependsOn": [ "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" ] + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "identity": { + "type": "SystemAssigned" + }, + "name": "[variables('funcAppName')]", + "location": "[resourceGroup().location]", + "kind": "functionapp", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms',variables('serverFarmName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('funcStorageName'))]" + ], + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]", + "siteConfig": { + "Use32BitWorkerProcess": false, + "powerShellVersion": "7.4", + "appSettings": [ + { + "name": "AzureWebJobsStorage", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTSHARE", + "value": "[variables('funcAppName')]" + }, + { + "name": "FUNCTIONS_EXTENSION_VERSION", + "value": "~4" + }, + { + "name": "WEBSITE_RUN_FROM_PACKAGE", + "value": "1" + }, + { + "name": "FUNCTIONS_WORKER_RUNTIME", + "value": "powershell" + } + ] + } + } + }, + { + "name": "[concat(variables('funcAppName'), '/ZipDeploy')]", + "type": "Microsoft.Web/sites/extensions", + "apiVersion": "2021-02-01", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', variables('funcAppName'))]" + ], + "properties": { + "packageUri": "https://cippreleases.blob.core.windows.net/cipp-api/latest.zip" + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-07-01", + "name": "[variables('funcStorageName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "funcStorageName" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2018-02-01", + "name": "[variables('serverFarmName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Y1", + "tier": "Dynamic", + "size": "Y1", + "family": "Y", + "capacity": 0 + }, + "properties": { + "perSiteScaling": false, + "maximumElasticWorkerCount": 1, + "isSpot": false, + "reserved": false, + "isXenon": false, + "hyperV": false, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "name": "[variables('serverFarmName')]", + "computeMode": "Dynamic" + } + }, + { + "type": "Microsoft.Web/staticSites", + "apiVersion": "2021-01-15", + "name": "[variables('swaName')]", + "location": "centralus", + "properties": { + "repositoryUrl": "[parameters('GithubRepository')]", + "branch": "main", + "repositoryToken": "[parameters('GithubToken')]", + "buildProperties": { + "appLocation": "/", + "apiLocation": "", + "appArtifactLocation": "" + } + }, + "sku": { + "name": "Standard", + "tier": "Standard" + } + }, + { + "type": "Microsoft.Web/staticSites/userProvidedFunctionApps", + "apiVersion": "2020-12-01", + "name": "[concat(variables('swaName'), '/', variables('swaName'))]", + "location": "centralus", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "functionAppResourceId": "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]", + "functionAppRegion": "[resourceGroup().location]" + } + } + ], + "outputs": {} +} diff --git a/deployment/DevAzureDeploymentTemplate.json b/deployment/DevAzureDeploymentTemplate.json new file mode 100644 index 000000000000..5e6077beab41 --- /dev/null +++ b/deployment/DevAzureDeploymentTemplate.json @@ -0,0 +1,334 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "defaultValue": "CIPPDev", + "type": "string", + "metadata": { + "description": "Name used as base-template to name the resources deployed in Azure." + } + }, + "TenantID": { + "defaultValue": "YourTenant.onmicrosoft.com", + "type": "string", + "metadata": { + "description": "Your tenant ID" + } + }, + "ApplicationID": { + "defaultValue": "LongApplicationID", + "type": "string", + "metadata": { + "description": "The Application ID for your Secure Application Model" + } + }, + "ApplicationSecret": { + "defaultValue": "LongApplicationSecret", + "type": "string", + "metadata": { + "description": "The Application Secret for your Secure Application Model." + } + }, + "Refreshtoken": { + "defaultValue": "LongRefreshtoken", + "type": "string", + "metadata": { + "description": "The Refresh token for your Secure Application Model." + } + }, + "GithubRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP", + "type": "string", + "metadata": { + "description": "URL to your Github Frontend fork." + } + }, + "GithubToken": { + "defaultValue": "GeneratedPassword", + "type": "string", + "metadata": { + "description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token)" + } + }, + "GithubAPIRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP-API", + "type": "string", + "metadata": { + "description": "URL to your Github backend fork." + } + } + }, + "variables": { + "suffix": "[substring(toLower(uniqueString(resourceGroup().id, resourceGroup().location)),0,5)]", + "funcAppName": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "funcStorageName": "[tolower(concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),16)), 'stg', variables('suffix')))]", + "serverFarmName": "[concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),14)), '-srv-', variables('suffix'))]", + "uniqueResourceNameBase": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "swaName": "[toLower(concat(parameters('baseName'), '-swa-', variables('suffix')))]" + }, + "resources": [ + { + "type": "Microsoft.KeyVault/vaults", + "name": "[variables('uniqueResourceNameBase')]", + "apiVersion": "2016-10-01", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "family": "A", + "name": "standard" + }, + "tenantId": "[subscription().tenantid]", + "accessPolicies": [ + { + "tenantId": "[subscription().tenantid]", + "objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]", + "permissions": { + "keys": [], + "secrets": ["all"], + "certificates": [] + } + } + ], + "enabledForDeployment": true, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": true + }, + "resources": [ + { + "type": "secrets", + "name": "applicationid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('ApplicationID')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "applicationsecret", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('Applicationsecret')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "refreshtoken", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('refreshtoken')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "tenantid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('tenantid')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + } + ], + "dependsOn": ["[resourceId('Microsoft.Web/sites', variables('funcAppName'))]"] + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "identity": { + "type": "SystemAssigned" + }, + "name": "[variables('funcAppName')]", + "location": "[resourceGroup().location]", + "kind": "functionapp", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms',variables('serverFarmName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('funcStorageName'))]" + ], + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]", + "siteConfig": { + "Use32BitWorkerProcess": false, + "powerShellVersion": "7.2", + "appSettings": [ + { + "name": "AzureWebJobsStorage", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTSHARE", + "value": "[variables('funcAppName')]" + }, + { + "name": "FUNCTIONS_EXTENSION_VERSION", + "value": "~4" + }, + { + "name": "ApplicationID", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationId)')]" + }, + { + "name": "ApplicationSecret", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationSecret)')]" + }, + { + "name": "RefreshToken", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/RefreshToken)')]" + }, + { + "name": "TenantID", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/tenantid)')]" + }, + { + "name": "FUNCTIONS_WORKER_RUNTIME", + "value": "powershell" + }, + { + "name": "WEBSITE_RUN_FROM_PACKAGE", + "value": "1" + } + ] + } + }, + "resources": [ + { + "apiVersion": "2015-08-01", + "name": "web", + "type": "sourcecontrols", + "dependsOn": ["[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]"], + "properties": { + "RepoUrl": "[parameters('GithubAPIRepository')]", + "repositoryToken": "[parameters('GithubToken')]", + "branch": "master", + "publishRunbook": true, + "gitHubActionConfiguration": { + "codeConfiguration": null, + "containerConfiguration": null, + "isLinux": false, + "generateWorkflowFile": true, + "workflowSettings": { + "appType": "functionapp", + "publishType": "code", + "os": "windows", + "variables": { + "runtimeVersion": "7.2", + "sitename": "[variables('funcAppName')]", + "slotname": "Production", + "publishingprofilesecretname": "[variables('funcAppName')]", + "branch": "master" + }, + "runtimeStack": "powershell", + "workflowApiVersion": "2020-12-01", + "useCanaryFusionServer": false + } + } + } + } + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-07-01", + "name": "[variables('funcStorageName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "funcStorageName" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2018-02-01", + "name": "[variables('serverFarmName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Y1", + "tier": "Dynamic", + "size": "Y1", + "family": "Y", + "capacity": 0 + }, + "properties": { + "perSiteScaling": false, + "maximumElasticWorkerCount": 1, + "isSpot": false, + "reserved": false, + "isXenon": false, + "hyperV": false, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "name": "[variables('serverFarmName')]", + "computeMode": "Dynamic" + } + }, + { + "type": "Microsoft.Web/staticSites", + "apiVersion": "2021-01-15", + "name": "[variables('swaName')]", + "location": "[resourceGroup().location]", + "properties": { + "repositoryUrl": "[parameters('GithubRepository')]", + "branch": "dev", + "repositoryToken": "[parameters('GithubToken')]", + "buildProperties": { + "appLocation": "/", + "apiLocation": "", + "appArtifactLocation": "" + } + }, + "sku": { + "name": "Standard", + "tier": "Standard" + } + }, + { + "type": "Microsoft.Web/staticSites/userProvidedFunctionApps", + "apiVersion": "2020-12-01", + "name": "[concat(variables('swaName'), '/', variables('swaName'))]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "functionAppResourceId": "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]", + "functionAppRegion": "[resourceGroup().location]" + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2018-09-01-preview", + "name": "[guid(variables('funcAppName'))]", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "roleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')]", + "principalId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]" + } + } + ], + "outputs": {} +} diff --git a/deployment/DevAzureDeploymentTemplate_regionoptions.json b/deployment/DevAzureDeploymentTemplate_regionoptions.json new file mode 100644 index 000000000000..f41e669076e5 --- /dev/null +++ b/deployment/DevAzureDeploymentTemplate_regionoptions.json @@ -0,0 +1,334 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "defaultValue": "CIPP", + "type": "string", + "metadata": { + "description": "Name used as base-template to name the resources deployed in Azure." + } + }, + "TenantID": { + "defaultValue": "YourTenant.onmicrosoft.com", + "type": "string", + "metadata": { + "description": "Your tenant ID" + } + }, + "ApplicationID": { + "defaultValue": "LongApplicationID", + "type": "string", + "metadata": { + "description": "The Application ID for your Secure Application Model" + } + }, + "ApplicationSecret": { + "defaultValue": "LongApplicationSecret", + "type": "string", + "metadata": { + "description": "The Application Secret for your Secure Application Model." + } + }, + "Refreshtoken": { + "defaultValue": "LongRefreshtoken", + "type": "string", + "metadata": { + "description": "The Refresh token for your Secure Application Model." + } + }, + "GithubRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP", + "type": "string", + "metadata": { + "description": "URL to your Github Frontend fork." + } + }, + "GithubToken": { + "defaultValue": "GeneratedPassword", + "type": "string", + "metadata": { + "description": "Your Github Repository token (see https://docs.microsoft.com/en-us/azure/static-web-apps/publish-azure-resource-manager?tabs=azure-cli#create-a-github-personal-access-token)" + } + }, + "GithubAPIRepository": { + "defaultValue": "https://github.com/KelvinTegelaar/CIPP-API", + "type": "string", + "metadata": { + "description": "URL to your Github backend fork." + } + } + }, + "variables": { + "suffix": "[substring(toLower(uniqueString(resourceGroup().id, resourceGroup().location)),0,5)]", + "funcAppName": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "funcStorageName": "[tolower(concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),16)), 'stg', variables('suffix')))]", + "serverFarmName": "[concat(substring(parameters('baseName'), 0, min(length(parameters('baseName')),14)), '-srv-', variables('suffix'))]", + "uniqueResourceNameBase": "[toLower(concat(parameters('baseName'), variables('suffix')))]", + "swaName": "[toLower(concat(parameters('baseName'), '-swa-', variables('suffix')))]" + }, + "resources": [ + { + "type": "Microsoft.KeyVault/vaults", + "name": "[variables('uniqueResourceNameBase')]", + "apiVersion": "2016-10-01", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "family": "A", + "name": "standard" + }, + "tenantId": "[subscription().tenantid]", + "accessPolicies": [ + { + "tenantId": "[subscription().tenantid]", + "objectId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]", + "permissions": { + "keys": [], + "secrets": ["all"], + "certificates": [] + } + } + ], + "enabledForDeployment": true, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": true + }, + "resources": [ + { + "type": "secrets", + "name": "applicationid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('ApplicationID')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "applicationsecret", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('Applicationsecret')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "refreshtoken", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('refreshtoken')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + }, + { + "type": "secrets", + "name": "tenantid", + "apiVersion": "2015-06-01", + "properties": { + "contentType": "text/plain", + "value": "[parameters('tenantid')]" + }, + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('uniqueResourceNameBase'))]" + ] + } + ], + "dependsOn": ["[resourceId('Microsoft.Web/sites', variables('funcAppName'))]"] + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "identity": { + "type": "SystemAssigned" + }, + "name": "[variables('funcAppName')]", + "location": "[resourceGroup().location]", + "kind": "functionapp", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms',variables('serverFarmName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('funcStorageName'))]" + ], + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]", + "siteConfig": { + "Use32BitWorkerProcess": false, + "powerShellVersion": "7.2", + "appSettings": [ + { + "name": "AzureWebJobsStorage", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('funcStorageName'), ';AccountKey=', listKeys(variables('funcStorageName'),'2015-05-01-preview').key1)]" + }, + { + "name": "WEBSITE_CONTENTSHARE", + "value": "[variables('funcAppName')]" + }, + { + "name": "FUNCTIONS_EXTENSION_VERSION", + "value": "~4" + }, + { + "name": "ApplicationID", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationId)')]" + }, + { + "name": "ApplicationSecret", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/ApplicationSecret)')]" + }, + { + "name": "RefreshToken", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/RefreshToken)')]" + }, + { + "name": "TenantID", + "value": "[concat('@Microsoft.KeyVault(SecretUri=https://',variables('uniqueResourceNameBase'), '.vault.azure.net/secrets/tenantid)')]" + }, + { + "name": "FUNCTIONS_WORKER_RUNTIME", + "value": "powershell" + }, + { + "name": "WEBSITE_RUN_FROM_PACKAGE", + "value": "1" + } + ] + } + }, + "resources": [ + { + "apiVersion": "2015-08-01", + "name": "web", + "type": "sourcecontrols", + "dependsOn": ["[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]"], + "properties": { + "RepoUrl": "[parameters('GithubAPIRepository')]", + "repositoryToken": "[parameters('GithubToken')]", + "branch": "master", + "publishRunbook": true, + "gitHubActionConfiguration": { + "codeConfiguration": null, + "containerConfiguration": null, + "isLinux": false, + "generateWorkflowFile": true, + "workflowSettings": { + "appType": "functionapp", + "publishType": "code", + "os": "windows", + "variables": { + "runtimeVersion": "7.2", + "sitename": "[variables('funcAppName')]", + "slotname": "Production", + "publishingprofilesecretname": "[variables('funcAppName')]", + "branch": "master" + }, + "runtimeStack": "powershell", + "workflowApiVersion": "2020-12-01", + "useCanaryFusionServer": false + } + } + } + } + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-07-01", + "name": "[variables('funcStorageName')]", + "location": "[resourceGroup().location]", + "tags": { + "displayName": "funStorageName" + }, + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2018-02-01", + "name": "[variables('serverFarmName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Y1", + "tier": "Dynamic", + "size": "Y1", + "family": "Y", + "capacity": 0 + }, + "properties": { + "perSiteScaling": false, + "maximumElasticWorkerCount": 1, + "isSpot": false, + "reserved": false, + "isXenon": false, + "hyperV": false, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "name": "[variables('serverFarmName')]", + "computeMode": "Dynamic" + } + }, + { + "type": "Microsoft.Web/staticSites", + "apiVersion": "2021-01-15", + "name": "[variables('swaName')]", + "location": "centralus", + "properties": { + "repositoryUrl": "[parameters('GithubRepository')]", + "branch": "dev", + "repositoryToken": "[parameters('GithubToken')]", + "buildProperties": { + "appLocation": "/", + "apiLocation": "", + "appArtifactLocation": "" + } + }, + "sku": { + "name": "Standard", + "tier": "Standard" + } + }, + { + "type": "Microsoft.Web/staticSites/userProvidedFunctionApps", + "apiVersion": "2020-12-01", + "name": "[concat(variables('swaName'), '/', variables('swaName'))]", + "location": "centralus", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "functionAppResourceId": "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]", + "functionAppRegion": "[resourceGroup().location]" + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2018-09-01-preview", + "name": "[guid(variables('funcAppName'))]", + "dependsOn": [ + "[resourceId('Microsoft.Web/staticSites', variables('swaName'))]", + "[resourceId('Microsoft.Web/sites/', variables('funcAppName'))]" + ], + "properties": { + "roleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')]", + "principalId": "[reference(resourceId('Microsoft.Web/sites', variables('funcAppName')),'2019-08-01', 'full').identity.principalId]" + } + } + ], + "outputs": {} +} From 81ee51ffa0576b02dc60ee5600a44cec3cde3e97 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Fri, 10 Jan 2025 13:40:30 -0500 Subject: [PATCH 04/29] update ARM templates --- deployment/AzureDeploymentTemplate.json | 2 +- deployment/DevAzureDeploymentTemplate_regionoptions.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/AzureDeploymentTemplate.json b/deployment/AzureDeploymentTemplate.json index aa445e3fd6c8..91ce52c678a7 100644 --- a/deployment/AzureDeploymentTemplate.json +++ b/deployment/AzureDeploymentTemplate.json @@ -220,7 +220,7 @@ "buildProperties": { "appLocation": "/", "apiLocation": "", - "appArtifactLocation": "" + "outputLocation": "/out" } }, "sku": { diff --git a/deployment/DevAzureDeploymentTemplate_regionoptions.json b/deployment/DevAzureDeploymentTemplate_regionoptions.json index f41e669076e5..6b84d7bfea84 100644 --- a/deployment/DevAzureDeploymentTemplate_regionoptions.json +++ b/deployment/DevAzureDeploymentTemplate_regionoptions.json @@ -294,7 +294,7 @@ "buildProperties": { "appLocation": "/", "apiLocation": "", - "appArtifactLocation": "" + "outputLocation": "/out" } }, "sku": { From 6b03ae9a90b61e25da663bef184204da66eff91b Mon Sep 17 00:00:00 2001 From: John Duprey Date: Fri, 10 Jan 2025 14:22:42 -0500 Subject: [PATCH 05/29] add run now on timers --- src/pages/cipp/advanced/timers.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/cipp/advanced/timers.js b/src/pages/cipp/advanced/timers.js index 456c50c4f89a..823f985f36e1 100644 --- a/src/pages/cipp/advanced/timers.js +++ b/src/pages/cipp/advanced/timers.js @@ -22,6 +22,7 @@ const Page = () => { "LastOccurrence", "Status", "PreferredProcessor", + "ErrorMsg", ]; const offCanvas = { @@ -72,7 +73,15 @@ const Page = () => { isFetching={fetchData.isPending} cardButton={} offCanvas={offCanvas} - actions={[]} + actions={[ + { + label: "Run Now", + type: "POST", + url: apiUrl, + data: { FunctionName: "Command", Parameters: "Parameters" }, + confirmText: "Do you want to run this task now?", + }, + ]} /> Date: Sat, 11 Jan 2025 02:41:16 +0100 Subject: [PATCH 06/29] Update AzureDeploymentTemplate.json --- deployment/AzureDeploymentTemplate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/AzureDeploymentTemplate.json b/deployment/AzureDeploymentTemplate.json index aa445e3fd6c8..91ce52c678a7 100644 --- a/deployment/AzureDeploymentTemplate.json +++ b/deployment/AzureDeploymentTemplate.json @@ -220,7 +220,7 @@ "buildProperties": { "appLocation": "/", "apiLocation": "", - "appArtifactLocation": "" + "outputLocation": "/out" } }, "sku": { From fb776d75502b56f6f7d8791dbd0a3132310be273 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Sat, 11 Jan 2025 02:42:49 +0100 Subject: [PATCH 07/29] Update AzureDeploymentTemplate_regionoptions.json --- deployment/AzureDeploymentTemplate_regionoptions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/AzureDeploymentTemplate_regionoptions.json b/deployment/AzureDeploymentTemplate_regionoptions.json index 1abff7bcc162..7e23726404c2 100644 --- a/deployment/AzureDeploymentTemplate_regionoptions.json +++ b/deployment/AzureDeploymentTemplate_regionoptions.json @@ -220,7 +220,7 @@ "buildProperties": { "appLocation": "/", "apiLocation": "", - "appArtifactLocation": "" + "outputLocation": "/out" } }, "sku": { From b80d6085b8a70cf666707de3e6c94cea6cc2c241 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Sat, 11 Jan 2025 02:43:01 +0100 Subject: [PATCH 08/29] Update AzureDeploymentTemplate_regionoptions.json --- deployment/AzureDeploymentTemplate_regionoptions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/AzureDeploymentTemplate_regionoptions.json b/deployment/AzureDeploymentTemplate_regionoptions.json index 1abff7bcc162..7e23726404c2 100644 --- a/deployment/AzureDeploymentTemplate_regionoptions.json +++ b/deployment/AzureDeploymentTemplate_regionoptions.json @@ -220,7 +220,7 @@ "buildProperties": { "appLocation": "/", "apiLocation": "", - "appArtifactLocation": "" + "outputLocation": "/out" } }, "sku": { From ec2f1df1afb6acd1501620171c74a8d92dd819af Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Sat, 11 Jan 2025 02:45:56 +0100 Subject: [PATCH 09/29] ci: add Azure Static Web Apps workflow file on-behalf-of: @Azure opensource@microsoft.com --- ...-static-web-apps-mango-field-04aac4710.yml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/azure-static-web-apps-mango-field-04aac4710.yml diff --git a/.github/workflows/azure-static-web-apps-mango-field-04aac4710.yml b/.github/workflows/azure-static-web-apps-mango-field-04aac4710.yml new file mode 100644 index 000000000000..5fe495a2155d --- /dev/null +++ b/.github/workflows/azure-static-web-apps-mango-field-04aac4710.yml @@ -0,0 +1,46 @@ +name: Azure Static Web Apps CI/CD + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened, closed] + branches: + - main + +jobs: + build_and_deploy_job: + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') + runs-on: ubuntu-latest + name: Build and Deploy Job + steps: + - uses: actions/checkout@v3 + with: + submodules: true + lfs: false + - name: Build And Deploy + id: builddeploy + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_FIELD_04AAC4710 }} + repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) + action: "upload" + ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### + # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig + app_location: "/" # App source code path + api_location: "" # Api source code path - optional + output_location: "/out" # Built app content directory - optional + ###### End of Repository/Build Configurations ###### + + close_pull_request_job: + if: github.event_name == 'pull_request' && github.event.action == 'closed' + runs-on: ubuntu-latest + name: Close Pull Request Job + steps: + - name: Close Pull Request + id: closepullrequest + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_FIELD_04AAC4710 }} + action: "close" From f2247a12dfc083e7c98d9a12b4ae06143cc55836 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Sat, 11 Jan 2025 18:37:02 +0100 Subject: [PATCH 10/29] array fix --- src/data/Extensions.json | 1 - src/pages/index.js | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/data/Extensions.json b/src/data/Extensions.json index 549a0fbca284..7bdb55f719d2 100644 --- a/src/data/Extensions.json +++ b/src/data/Extensions.json @@ -33,7 +33,6 @@ "logoDark": "/assets/integrations/sherweb_dark.png", "description": "Enable the Sherweb integration to manage your CSP licensing from CIPP.", "helpText": "This integration allows you to manage your CSP licensing from CIPP. Purchase new licenses while adding or editing users in CIPP. Not a Sherweb partner? Sign up for the Sherweb Cloud Services for MSPs program.", - "alertText": "This integration is in a closed beta. To register for interest please visit the registration page. Filling in information while not in the beta is possible, but will not enable the functionality.", "mappingRequired": true, "links": [ { diff --git a/src/pages/index.js b/src/pages/index.js index 141c71f7831f..904e9fd5ed40 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -118,6 +118,10 @@ const Page = () => { for (const [, standard] of Object.entries(combinedStandards)) { const actions = standard.action || []; + if (!Array.isArray(actions)) { + actions = [actions]; + } + actions?.forEach((actionObj) => { if (actionObj?.value === "Remediate") { remediateCount++; From 913b358ed89e36be22537c6881dfca39661c34b5 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Sat, 11 Jan 2025 12:52:58 -0500 Subject: [PATCH 11/29] fix blocked tenants disappearing --- src/components/CippSettings/CippCustomRoles.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/CippSettings/CippCustomRoles.jsx b/src/components/CippSettings/CippCustomRoles.jsx index 311fee517c16..2f8ddd517dcc 100644 --- a/src/components/CippSettings/CippCustomRoles.jsx +++ b/src/components/CippSettings/CippCustomRoles.jsx @@ -142,7 +142,7 @@ export const CippCustomRoles = () => { alltenant = true; } }); - if (alltenant && (blockedTenants?.length === 0 || !blockedTenants)) { + if (alltenant) { setAllTenantSelected(true); } else { setAllTenantSelected(false); @@ -299,7 +299,7 @@ export const CippCustomRoles = () => { name="allowedTenants" fullWidth={true} /> - {allTenantSelected && ( + {allTenantSelected && blockedTenants?.length == 0 && ( All tenants selected, no tenant restrictions will be applied unless blocked tenants are specified. From f31b1e8d539fea77cbc70a036af2f4020f9f5615 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Sat, 11 Jan 2025 19:24:34 +0100 Subject: [PATCH 12/29] Delete .github/workflows/azure-static-web-apps-mango-field-04aac4710.yml --- ...-static-web-apps-mango-field-04aac4710.yml | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 .github/workflows/azure-static-web-apps-mango-field-04aac4710.yml diff --git a/.github/workflows/azure-static-web-apps-mango-field-04aac4710.yml b/.github/workflows/azure-static-web-apps-mango-field-04aac4710.yml deleted file mode 100644 index 5fe495a2155d..000000000000 --- a/.github/workflows/azure-static-web-apps-mango-field-04aac4710.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Azure Static Web Apps CI/CD - -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened, closed] - branches: - - main - -jobs: - build_and_deploy_job: - if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') - runs-on: ubuntu-latest - name: Build and Deploy Job - steps: - - uses: actions/checkout@v3 - with: - submodules: true - lfs: false - - name: Build And Deploy - id: builddeploy - uses: Azure/static-web-apps-deploy@v1 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_FIELD_04AAC4710 }} - repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) - action: "upload" - ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### - # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig - app_location: "/" # App source code path - api_location: "" # Api source code path - optional - output_location: "/out" # Built app content directory - optional - ###### End of Repository/Build Configurations ###### - - close_pull_request_job: - if: github.event_name == 'pull_request' && github.event.action == 'closed' - runs-on: ubuntu-latest - name: Close Pull Request Job - steps: - - name: Close Pull Request - id: closepullrequest - uses: Azure/static-web-apps-deploy@v1 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_FIELD_04AAC4710 }} - action: "close" From a8924b3e911a29d588d3e064039ba867353350a2 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Sat, 11 Jan 2025 13:27:43 -0500 Subject: [PATCH 13/29] fix padding if labels not present tidy dashboard page try to safely handle standards --- src/components/CippCards/CippPropertyListCard.jsx | 8 ++++++++ .../CippComponents/CippPropertyList.jsx | 15 +++++++++++++++ src/components/property-list-item.js | 14 +++++--------- src/pages/index.js | 15 ++++++++++----- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/components/CippCards/CippPropertyListCard.jsx b/src/components/CippCards/CippPropertyListCard.jsx index 4b175cea9d8a..62b4578358d6 100644 --- a/src/components/CippCards/CippPropertyListCard.jsx +++ b/src/components/CippCards/CippPropertyListCard.jsx @@ -39,6 +39,12 @@ export const CippPropertyListCard = (props) => { const firstHalf = propertyItems.slice(0, half); const secondHalf = propertyItems.slice(half, propertyItems.length); + const isLabelPresent = (item) => { + return item?.label === "" || item?.label === undefined || item?.label === null; + }; + + const setPadding = isLabelPresent ? { py: 0.5, px: 3 } : { py: 1.5, px: 3 }; + return ( <> @@ -56,6 +62,7 @@ export const CippPropertyListCard = (props) => { align={align} label={item.label} value={} + sx={setPadding} /> ))} @@ -66,6 +73,7 @@ export const CippPropertyListCard = (props) => { divider={showDivider} copyItems={copyItems} key={`${index}-index-PropertyListOffCanvas`} + sx={setPadding} {...item} /> )) diff --git a/src/components/CippComponents/CippPropertyList.jsx b/src/components/CippComponents/CippPropertyList.jsx index ee3bfa641034..4c9fd3800820 100644 --- a/src/components/CippComponents/CippPropertyList.jsx +++ b/src/components/CippComponents/CippPropertyList.jsx @@ -16,6 +16,11 @@ export const CippPropertyList = (props) => { const firstHalf = propertyItems.slice(0, half); const secondHalf = propertyItems.slice(half, propertyItems.length); + const isLabelPresent = (item) => { + return item?.label === "" || item?.label === undefined || item?.label === null; + }; + + const setPadding = isLabelPresent ? { py: 0.5, px: 3 } : { py: 1.5, px: 3 }; return ( <> {layout === "single" ? ( @@ -28,6 +33,7 @@ export const CippPropertyList = (props) => { align={align} label={item.label} value={} + sx={setPadding} {...item} /> ))} @@ -39,6 +45,7 @@ export const CippPropertyList = (props) => { divider={showDivider} copyItems={copyItems} key={`${index}-index-PropertyListOffCanvas`} + sx={setPadding} {...item} /> )) @@ -69,6 +76,7 @@ export const CippPropertyList = (props) => { align={align} label={item.label} value={} + sx={setPadding} /> ))} @@ -79,6 +87,7 @@ export const CippPropertyList = (props) => { divider={showDivider} copyItems={copyItems} key={`${index}-index-PropertyListOffCanvas`} + sx={setPadding} {...item} /> )) @@ -93,6 +102,11 @@ export const CippPropertyList = (props) => { align={align} label={item.label} value={} + sx={() => { + if (item?.label === "" || item?.label === undefined || item?.label === null) { + return { py: 0 }; + } + }} /> ))} @@ -103,6 +117,7 @@ export const CippPropertyList = (props) => { divider={showDivider} copyItems={copyItems} key={`${index}-index-PropertyListOffCanvas`} + sx={setPadding} {...item} /> )) diff --git a/src/components/property-list-item.js b/src/components/property-list-item.js index 70318631bf36..aa61fa0b5d23 100644 --- a/src/components/property-list-item.js +++ b/src/components/property-list-item.js @@ -21,19 +21,15 @@ export const PropertyListItem = (props) => { value = "", type, copyItems, + sx = { + px: 3, + py: 1.5, + }, ...other } = props; const [showPassword, setShowPassword] = useState(false); return ( - + { // Identify which templates apply: const applicableTemplates = standardsData.filter((template) => { - const tenantInFilter = template?.tenantFilter?.some((tf) => tf.value === currentTenant); + const tenantInFilter = + template?.tenantFilter?.length > 0 && + template.tenantFilter.some((tf) => tf.value === currentTenant); const allTenantsTemplate = - template.tenantFilter?.some((tf) => tf.value === "AllTenants") && - !template.excludedTenants?.some((et) => et.value === currentTenant); + template?.tenantFilter?.length > 0 && + template.tenantFilter.some((tf) => tf.value === "AllTenants") && + (!template?.excludedTenants || + (Array.isArray(template?.excludedTenants) && template?.excludedTenants?.length === 0) || + !template?.excludedTenants?.some((et) => et.value === currentTenant)); return tenantInFilter || allTenantsTemplate; }); @@ -238,10 +243,10 @@ const Page = () => { propertyItems={organization.data?.verifiedDomains ?.slice(0, domainVisible ? undefined : 3) .map((domain, idx) => ({ - label: `Domain`, + label: "", value: domain.name, }))} - actions={ + actionItems={ organization.data?.verifiedDomains?.length > 3 && (