From d6d0327f011199e030762392de7b10b9fe51eb22 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Thu, 14 Oct 2021 20:35:20 +0530 Subject: [PATCH 01/50] Add base bicep script for service fabric cluster and add nested cua bicep file. --- .../clusters/.bicep/nested_cuaId.bicep | 0 .../clusters/deploy.bicep | 223 ++++++++++++++++++ 2 files changed, 223 insertions(+) create mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_cuaId.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/deploy.bicep diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_cuaId.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_cuaId.bicep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep new file mode 100644 index 0000000000..17a168a0cb --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -0,0 +1,223 @@ +// This file can only be deployed at a resource group scope. +targetScope = 'resourceGroup' + +@description('Required. Name of the Serivce Fabric cluster.') +param serviceFabricClusterName string = '' + +@description('Optional. Location for all resources.') +param location string = resourceGroup().location + +@description('Optional. Tags of the resource.') +param tags object = {} + +@description('Optional. Switch to lock storage from deletion.') +param lockForDeletion bool = false + +@description('Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered') +param cuaId string = '' + +@allowed([ + 'BackupRestoreService' + 'DnsService' + 'RepairManager' + 'ResourceMonitorService' +]) +@description('Optional. The list of add-on features to enable in the cluster.') +param addOnFeatures array = [] + +@description('Required. Number of unused versions per application type to keep.') +param maxUnusedVersionsToKeep int = 3 + +@description('Optional. Azure active directory client application id.') +param clientApplication string = '' + +@description('Optional. Azure active directory cluster application id.') +param clusterApplication string = '' + +@description('Optional. Azure active directory tenant id.') +param tenantId string = '' + +@description('Required. Thumbprint of the primary certificate.') +param thumbprint string = '' + +@description('Optional. Thumbprint of the secondary certificate.') +param thumbprintSecondary string = '' + +@allowed([ + 'AddressBook' + 'AuthRoot' + 'CertificateAuthority' + 'Disallowed' + 'My' + 'Root' + 'TrustedPeople' + 'TrustedPublisher' +]) +@description('Optional.The local certificate store location for cluster certificate.') +param clusterCertificatex509StoreName string = 'Root' + +@description('Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster.') +param certificateCommonNames object = {} + +@description('Optional. The list of client certificates referenced by common name that are allowed to manage the cluster.') +param clientCertificateCommonNames array = [] + +@description('Optional. The list of client certificates referenced by thumbprint that are allowed to manage the cluster.') +param clientCertificateThumbprints array = [] + +@description('Optional. The Service Fabric runtime version of the cluster. This property can only by set the user when upgradeMode is set to "Manual". To get list of available Service Fabric versions for new clusters use ClusterVersion API. To get the list of available version for existing clusters use availableClusterVersions.') +param clusterCodeVersion string = '' + +@description('Optional. The storage account information for storing Service Fabric diagnostic logs.') +param diagnosticsStorageAccountConfig object = {} + +@description('Optional. Indicates if the event store service is enabled.') +param eventStoreServiceEnabled bool = false + +@description('Optional. The list of custom fabric settings to configure the cluster.') +param fabricSettings array = [] + +@description('Optional. Indicates if infrastructure service manager is enabled.') +param infrastructureServiceManager bool = false + +@description('Required. The http management endpoint of the cluster.') +param managementEndpoint string = '' + +@description('Required. The list of node types in the cluster.') +param nodeTypes array = [] + +@description('Optional. Indicates a list of notification channels for cluster events.') +param notifications array = [] + +@allowed([ + 'Bronze' + 'Gold' + 'None' + 'Platinum' + 'Silver' +]) +@description('Optional. The reliability level sets the replica set size of system services. Learn about ReliabilityLevel (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-capacity). - None - Run the System services with a target replica set count of 1. This should only be used for test clusters. - Bronze - Run the System services with a target replica set count of 3. This should only be used for test clusters. - Silver - Run the System services with a target replica set count of 5. - Gold - Run the System services with a target replica set count of 7. - Platinum - Run the System services with a target replica set count of 9.') +param reliabilityLevel string = 'None' + +@description('Optional. Describes the certificate details.') +param reverseProxyCertificate object = {} + +@description('Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster.') +param reverseProxyCertificateCommonNames object = {} + +@allowed([ + 'Hierarchical' + 'Parallel' +]) +@description('Optional. This property controls the logical grouping of VMs in upgrade domains (UDs). This property cannot be modified if a node type with multiple Availability Zones is already present in the cluster.') +param sfZonalUpgradeMode string = 'Hierarchical' + +@description('Optional. Describes the policy used when upgrading the cluster.') +param upgradeDescription object = {} + +@allowed([ + 'Automatic' + 'Manual' +]) +@description('Optional. The upgrade mode of the cluster when new Service Fabric runtime version is available.') +param upgradeMode string = 'Automatic' + +@description('Optional. Indicates the end date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC).') +param upgradePauseEndTimestampUtc string = '' + +@description('Optional. Indicates the start date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC).') +param upgradePauseStartTimestampUtc string = '' + +@allowed([ + 'Wave0' + 'Wave1' + 'Wave2' +]) +@description('Optional. Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0.') +param upgradeWave string = 'Wave0' + +@description('Optional. The VM image VMSS has been configured with. Generic names such as Windows or Linux can be used') +param vmImage string = '' + +@allowed([ + 'Hierarchical' + 'Parallel' +]) +@description('Optional. This property defines the upgrade mode for the virtual machine scale set, it is mandatory if a node type with multiple Availability Zones is added.') +param vmssZonalUpgradeMode string = 'Hierarchical' + +@description('Optional. Boolean to pause automatic runtime version upgrades to the cluster.') +param waveUpgradePaused bool = false + +// Var section +var builtInRoleNames = {} + +module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { + name: 'pid-${cuaId}' + params: {} +} + +// Service Fabric cluster resource +resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { + name: serviceFabricClusterName + location: location + tags: tags + properties: { + addOnFeatures: addOnFeatures + + applicationTypeVersionsCleanupPolicy: { + maxUnusedVersionsToKeep: maxUnusedVersionsToKeep + } + + azureActiveDirectory: { + clientApplication: clientApplication + clusterApplication: clusterApplication + tenantId: tenantId + } + + certificate: { + thumbprint: thumbprint + thumbprintSecondary: thumbprintSecondary + x509StoreName: clusterCertificatex509StoreName + } + + certificateCommonNames: certificateCommonNames + clientCertificateCommonNames: clientCertificateCommonNames + clientCertificateThumbprints: clientCertificateThumbprints + clusterCodeVersion: clusterCodeVersion + diagnosticsStorageAccountConfig: diagnosticsStorageAccountConfig + eventStoreServiceEnabled: eventStoreServiceEnabled + fabricSettings: fabricSettings + infrastructureServiceManager: infrastructureServiceManager + managementEndpoint: managementEndpoint + nodeTypes: nodeTypes + notifications: notifications + reliabilityLevel: reliabilityLevel + reverseProxyCertificate: reverseProxyCertificate + reverseProxyCertificateCommonNames: reverseProxyCertificateCommonNames + sfZonalUpgradeMode: sfZonalUpgradeMode + upgradeDescription: upgradeDescription + upgradeMode: upgradeMode + upgradePauseEndTimestampUtc: upgradePauseEndTimestampUtc + upgradePauseStartTimestampUtc: upgradePauseStartTimestampUtc + upgradeWave: upgradeWave + vmImage: vmImage + vmssZonalUpgradeMode: vmssZonalUpgradeMode + waveUpgradePaused: waveUpgradePaused + } +} + +// Service Fabric cluster resource lock +resource serviceFabricCluster_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lockForDeletion) { + name: '${serviceFabricCluster.name}-doNotDelete' + properties: { + level: 'CanNotDelete' + notes: 'Do not delete!' + } + scope: serviceFabricCluster +} + +// Outputs section +output serviceFabricClusterName string = serviceFabricCluster.name +output serviceFabricClusterId string = serviceFabricCluster.id +output serviceFabricClusterProperties object = serviceFabricCluster.properties From 54f758eb2f698cc35b1d9315c410969db7c08de5 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Mon, 18 Oct 2021 18:20:53 +0530 Subject: [PATCH 02/50] Update bicep file and add param file. --- .../clusters/deploy.bicep | 56 +++++++------------ .../clusters/parameters/parameters.json | 42 ++++++++++++++ 2 files changed, 61 insertions(+), 37 deletions(-) create mode 100644 arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 17a168a0cb..c95523b59a 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -1,6 +1,7 @@ // This file can only be deployed at a resource group scope. targetScope = 'resourceGroup' +// Service Fabric cluster resource and lock params @description('Required. Name of the Serivce Fabric cluster.') param serviceFabricClusterName string = '' @@ -28,33 +29,11 @@ param addOnFeatures array = [] @description('Required. Number of unused versions per application type to keep.') param maxUnusedVersionsToKeep int = 3 -@description('Optional. Azure active directory client application id.') -param clientApplication string = '' +@description('Optional. Object containing Azure active directory client application id, cluster application id and tenant id.') +param azureActiveDirectory object = {} -@description('Optional. Azure active directory cluster application id.') -param clusterApplication string = '' - -@description('Optional. Azure active directory tenant id.') -param tenantId string = '' - -@description('Required. Thumbprint of the primary certificate.') -param thumbprint string = '' - -@description('Optional. Thumbprint of the secondary certificate.') -param thumbprintSecondary string = '' - -@allowed([ - 'AddressBook' - 'AuthRoot' - 'CertificateAuthority' - 'Disallowed' - 'My' - 'Root' - 'TrustedPeople' - 'TrustedPublisher' -]) -@description('Optional.The local certificate store location for cluster certificate.') -param clusterCertificatex509StoreName string = 'Root' +@description('Optional. Describes the certificate details like thumbprint of the primary certificate, thumbprint of the secondary certificate and the local certificate store location') +param certificate object = {} @description('Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster.') param certificateCommonNames object = {} @@ -150,6 +129,18 @@ param vmssZonalUpgradeMode string = 'Hierarchical' param waveUpgradePaused bool = false // Var section +var azureActiveDirectory_var = { + clientApplication: (!empty(azureActiveDirectory) ? azureActiveDirectory.clientApplication : json('null')) + clusterApplication: (!empty(azureActiveDirectory) ? azureActiveDirectory.clusterApplication : json('null')) + tenantId: (!empty(azureActiveDirectory) ? azureActiveDirectory.tenantId : json('null')) +} + +var certificate_var = { + thumbprint: (!empty(certificate) ? certificate.thumbprint : json('null')) + thumbprintSecondary: (!empty(certificate) ? certificate.thumbprintSecondary : json('null')) + x509StoreName: (!empty(certificate) ? certificate.x509StoreName : json('null')) +} + var builtInRoleNames = {} module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { @@ -169,17 +160,8 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { maxUnusedVersionsToKeep: maxUnusedVersionsToKeep } - azureActiveDirectory: { - clientApplication: clientApplication - clusterApplication: clusterApplication - tenantId: tenantId - } - - certificate: { - thumbprint: thumbprint - thumbprintSecondary: thumbprintSecondary - x509StoreName: clusterCertificatex509StoreName - } + azureActiveDirectory: (!empty(azureActiveDirectory) ? azureActiveDirectory_var : json('null')) + certificate: (!empty(certificate) ? certificate_var : json('null')) certificateCommonNames: certificateCommonNames clientCertificateCommonNames: clientCertificateCommonNames diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json new file mode 100644 index 0000000000..1740e553db --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "serviceFabricClusterName": { + "value": "sxx-az-sfc-weu-x-001" + }, + "location": { + "value": "centralIndia" + }, + "tags": { + "value": { + "costCenter": "1234", + "environment": "prod", + "contactinfo": "someone@company.com" + } + }, + "lockForDeletion": { + "value": false + }, + "addOnFeatures": { + "value": [] + }, + "maxUnusedVersionsToKeep": { + "value": 2 // Mandatory + }, + "azureActiveDirectory": { + "value": { + "clientApplication": "", + "clusterApplication": "", + "tenantId": "" + } + }, + "certificate": { + "value": { + "thumbprint": "", // Mandatory + "thumbprintSecondary": "", + "x509StoreName": "" // Possible values 'AddressBook', 'AuthRoot', 'CertificateAuthority', 'Disallowed', 'My', 'Root', 'TrustedPeople', 'TrustedPublisher' + } + } + } +} From 3919fdb9e53a6bee7ce34939ed949e6bd079394a Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Mon, 18 Oct 2021 20:32:41 +0530 Subject: [PATCH 03/50] Update biceps and parameters file. --- .../clusters/deploy.bicep | 32 ++++++++++++++++--- .../clusters/parameters/parameters.json | 28 ++++++++++++++-- 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index c95523b59a..754b334fa5 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -141,6 +141,26 @@ var certificate_var = { x509StoreName: (!empty(certificate) ? certificate.x509StoreName : json('null')) } +var certificateCommonNamesList_var = [for index in range(0, (!empty(certificateCommonNames) ? length(certificateCommonNames.commonNames) : 0)): { + commonNames: '${certificateCommonNames.commonNames[index]}' +}] + +var certificateCommonNames_var = { + commonNames: (!empty(certificateCommonNames) ? certificateCommonNamesList_var : json('null')) + x509StoreName: (!empty(certificateCommonNames) ? certificateCommonNames.x509StoreName : json('null')) +} + +var clientCertificateCommonNames_var = [for index in range(0, (!empty(clientCertificateCommonNames) ? length(clientCertificateCommonNames) : 0)): { + certificateCommonName: (!empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateCommonName}' : json('null')) + certificateIssuerThumbprint: (!empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateIssuerThumbprint}' : json('null')) + isAdmin: (!empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].isAdmin}' : json('null')) +}] + +var clientCertificateThumbprints_var = [for index in range(0, (!empty(clientCertificateThumbprints) ? length(clientCertificateThumbprints) : 0)): { + certificateThumbprint: (!empty(clientCertificateThumbprints) ? '${clientCertificateThumbprints[index].certificateThumbprint}' : json('null')) + isAdmin: (!empty(clientCertificateThumbprints) ? '${clientCertificateThumbprints[index].isAdmin}' : json('null')) +}] + var builtInRoleNames = {} module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { @@ -162,11 +182,11 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { azureActiveDirectory: (!empty(azureActiveDirectory) ? azureActiveDirectory_var : json('null')) certificate: (!empty(certificate) ? certificate_var : json('null')) + certificateCommonNames: (!empty(certificateCommonNames) ? certificateCommonNames_var : json('null')) + clientCertificateCommonNames: (!empty(clientCertificateCommonNames) ? clientCertificateCommonNames_var : json('null')) + clientCertificateThumbprints: (!empty(clientCertificateThumbprints) ? clientCertificateThumbprints_var : json('null')) - certificateCommonNames: certificateCommonNames - clientCertificateCommonNames: clientCertificateCommonNames - clientCertificateThumbprints: clientCertificateThumbprints - clusterCodeVersion: clusterCodeVersion + clusterCodeVersion: (!empty(clusterCodeVersion) ? clusterCodeVersion : json('null')) diagnosticsStorageAccountConfig: diagnosticsStorageAccountConfig eventStoreServiceEnabled: eventStoreServiceEnabled fabricSettings: fabricSettings @@ -203,3 +223,7 @@ resource serviceFabricCluster_lock 'Microsoft.Authorization/locks@2016-09-01' = output serviceFabricClusterName string = serviceFabricCluster.name output serviceFabricClusterId string = serviceFabricCluster.id output serviceFabricClusterProperties object = serviceFabricCluster.properties +// Outputs section +output serviceFabricClusterName string = serviceFabricCluster.name +output serviceFabricClusterId string = serviceFabricCluster.id +output serviceFabricClusterProperties object = serviceFabricCluster.properties diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json index 1740e553db..79bd544aa1 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -33,10 +33,34 @@ }, "certificate": { "value": { - "thumbprint": "", // Mandatory + "thumbprint": "", // If 'certificate' is provided then this is mandatory "thumbprintSecondary": "", - "x509StoreName": "" // Possible values 'AddressBook', 'AuthRoot', 'CertificateAuthority', 'Disallowed', 'My', 'Root', 'TrustedPeople', 'TrustedPublisher' + "x509StoreName": "" // Possible values are 'AddressBook', 'AuthRoot', 'CertificateAuthority', 'Disallowed', 'My', 'Root', 'TrustedPeople', 'TrustedPublisher' } + }, + "certificateCommonNames": { + "value": { + "commonNames": [ // The list of server certificates referenced by common name that are used to secure the cluster. + { + "certificateCommonName": "", // If 'certificateCommonNames' is provided then this is mandatory + "certificateIssuerThumbprint": "" // If 'certificateCommonNames' is provided then this is mandatory + } + ], + "x509StoreName": "" // Possible values are 'AddressBook', 'AuthRoot', 'CertificateAuthority', 'Disallowed', 'My', 'Root', 'TrustedPeople', 'TrustedPublisher' + } + }, + "clientCertificateCommonNames": { + "value": [{ + "certificateCommonName": "", // If 'clientCertificateCommonNames' is passed then this is mandatory + "certificateIssuerThumbprint": "", // If 'clientCertificateCommonNames' is passed then this is mandatory + "isAdmin": "" // Bool. If 'clientCertificateCommonNames' is passed then this is mandatory + }] + }, + "clientCertificateThumbprints": { + "value": [{ + "certificateThumbprint": "", // If 'clientCertificateThumbprints' is passed then this is mandatory + "isAdmin": "" // If 'clientCertificateThumbprints' is passed then this is mandatory + }] } } } From 8c00c5e05b8e38bfe1e9f957a2372c110b66b5b0 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Mon, 18 Oct 2021 20:36:45 +0530 Subject: [PATCH 04/50] Remove duplicate output section. --- arm/Microsoft.ServiceFabric/clusters/deploy.bicep | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 754b334fa5..3bc9d5a429 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -185,8 +185,8 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { certificateCommonNames: (!empty(certificateCommonNames) ? certificateCommonNames_var : json('null')) clientCertificateCommonNames: (!empty(clientCertificateCommonNames) ? clientCertificateCommonNames_var : json('null')) clientCertificateThumbprints: (!empty(clientCertificateThumbprints) ? clientCertificateThumbprints_var : json('null')) - clusterCodeVersion: (!empty(clusterCodeVersion) ? clusterCodeVersion : json('null')) + diagnosticsStorageAccountConfig: diagnosticsStorageAccountConfig eventStoreServiceEnabled: eventStoreServiceEnabled fabricSettings: fabricSettings @@ -223,7 +223,3 @@ resource serviceFabricCluster_lock 'Microsoft.Authorization/locks@2016-09-01' = output serviceFabricClusterName string = serviceFabricCluster.name output serviceFabricClusterId string = serviceFabricCluster.id output serviceFabricClusterProperties object = serviceFabricCluster.properties -// Outputs section -output serviceFabricClusterName string = serviceFabricCluster.name -output serviceFabricClusterId string = serviceFabricCluster.id -output serviceFabricClusterProperties object = serviceFabricCluster.properties From e969e0927d34381ed146e31947abd61459db0b05 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Tue, 19 Oct 2021 18:35:12 +0530 Subject: [PATCH 05/50] Update deploy.bicep and params file and add the nested rbac file. --- .../clusters/.bicep/nested_rbac.bicep | 11 ++ .../clusters/deploy.bicep | 145 +++++++++++++++--- .../clusters/parameters/parameters.json | 56 +++++++ 3 files changed, 192 insertions(+), 20 deletions(-) create mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_rbac.bicep diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_rbac.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_rbac.bicep new file mode 100644 index 0000000000..9da0c50325 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_rbac.bicep @@ -0,0 +1,11 @@ +param roleAssignmentObj object +param builtInRoleNames object +param resourceName string + +resource roleAssigment 'Microsoft.ServiceFabric/clusters/providers/roleAssignments@2020-04-01-preview' = [for principalId in roleAssignmentObj.principalIds: { + name: '${resourceName}/Microsoft.Authorization/${guid(resourceName, principalId, roleAssignmentObj.roleDefinitionIdOrName)}' + properties: { + roleDefinitionId: (contains(builtInRoleNames, roleAssignmentObj.roleDefinitionIdOrName) ? builtInRoleNames[roleAssignmentObj.roleDefinitionIdOrName] : roleAssignmentObj.roleDefinitionIdOrName) + principalId: principalId + } +}] diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 3bc9d5a429..3742df1747 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -60,7 +60,7 @@ param fabricSettings array = [] param infrastructureServiceManager bool = false @description('Required. The http management endpoint of the cluster.') -param managementEndpoint string = '' +param managementEndpoint string @description('Required. The list of node types in the cluster.') param nodeTypes array = [] @@ -128,6 +128,9 @@ param vmssZonalUpgradeMode string = 'Hierarchical' @description('Optional. Boolean to pause automatic runtime version upgrades to the cluster.') param waveUpgradePaused bool = false +@description('Optional. Array of role assignment objects that contain the \'roleDefinitionIdOrName\' and \'principalId\' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or it\'s fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'') +param roleAssignments array = [] + // Var section var azureActiveDirectory_var = { clientApplication: (!empty(azureActiveDirectory) ? azureActiveDirectory.clientApplication : json('null')) @@ -142,7 +145,7 @@ var certificate_var = { } var certificateCommonNamesList_var = [for index in range(0, (!empty(certificateCommonNames) ? length(certificateCommonNames.commonNames) : 0)): { - commonNames: '${certificateCommonNames.commonNames[index]}' + commonNames: certificateCommonNames.commonNames[index] }] var certificateCommonNames_var = { @@ -161,7 +164,100 @@ var clientCertificateThumbprints_var = [for index in range(0, (!empty(clientCert isAdmin: (!empty(clientCertificateThumbprints) ? '${clientCertificateThumbprints[index].isAdmin}' : json('null')) }] -var builtInRoleNames = {} +var diagnosticsStorageAccountConfig_var = { + blobEndpoint: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.blobEndpoint : json('null')) + protectedAccountKeyName: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.protectedAccountKeyName : json('null')) + protectedAccountKeyName2: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.protectedAccountKeyName2 : json('null')) + queueEndpoint: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.queueEndpoint : json('null')) + storageAccountName: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.storageAccountName : json('null')) + tableEndpoint: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.tableEndpoint : json('null')) +} + +var fabricSettings_var = [for index in range(0, (!empty(fabricSettings) ? length(fabricSettings) : 0)): { + name: (!empty(fabricSettings) ? fabricSettings[index].name : json('null')) + parameters: (!empty(fabricSettings) ? fabricSettings[index].parameters : json('null')) +}] + +var nodeTypes_var = [for index in range(0, (!empty(nodeTypes) ? length(nodeTypes) : 0)): { + applicationPorts: { + endPort: (!empty(nodeTypes) ? nodeTypes[index].applicationPorts.endPort : json('null')) + startPort: (!empty(nodeTypes) ? nodeTypes[index].applicationPorts.startPort : json('null')) + } + capacities: (!empty(nodeTypes) ? nodeTypes[index].capacities : json('null')) + clientConnectionEndpointPort: (!empty(nodeTypes) ? nodeTypes[index].clientConnectionEndpointPort : json('null')) + durabilityLevel: '${(!empty(nodeTypes) ? nodeTypes[index].durabilityLevel : json('null'))}' + ephemeralPorts: { + endPort: (!empty(nodeTypes) ? nodeTypes[index].ephemeralPorts.endPort : json('null')) + startPort: (!empty(nodeTypes) ? nodeTypes[index].ephemeralPorts.startPort : json('null')) + } + httpGatewayEndpointPort: (!empty(nodeTypes) ? nodeTypes[index].httpGatewayEndpointPort : json('null')) + isPrimary: (!empty(nodeTypes) ? nodeTypes[index].isPrimary : json('null')) + isStateless: (!empty(nodeTypes) ? nodeTypes[index].isStateless : json('null')) + multipleAvailabilityZones: (!empty(nodeTypes) ? nodeTypes[index].multipleAvailabilityZones : json('null')) + name: '${(!empty(nodeTypes) ? nodeTypes[index].name : json('null'))}' + placementProperties: (!empty(nodeTypes) ? nodeTypes[index].placementProperties : json('null')) + reverseProxyEndpointPort: (!empty(nodeTypes) ? nodeTypes[index].reverseProxyEndpointPort : json('null')) + vmInstanceCount: (!empty(nodeTypes) ? nodeTypes[index].vmInstanceCount : json('null')) +}] + +var notifications_var = [for index in range(0, (!empty(notifications) ? length(notifications) : 0)): { + isEnabled: (!empty(notifications) ? notifications[index].isEnabled : json('null')) + notificationCategory: (!empty(notifications) ? notifications[index].notificationCategory : json('null')) + notificationLevel: (!empty(notifications) ? notifications[index].notificationLevel : json('null')) + notificationTargets: (!empty(notifications) ? notifications[index].notificationTargets : json('null')) +}] + +var reverseProxyCertificate_var = { + thumbprint: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprint : json('null')) + thumbprintSecondary: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprintSecondary : json('null')) + x509StoreName: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.x509StoreName : json('null')) +} + +var reverseProxyCertificateCommonNamesList_var = [for index in range(0, (!empty(reverseProxyCertificateCommonNames) ? length(reverseProxyCertificateCommonNames.commonNames) : 0)): { + commonNames: reverseProxyCertificateCommonNames.commonNames[index] +}] + +var reverseProxyCertificateCommonNames_var = { + commonNames: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNamesList_var : json('null')) + x509StoreName: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames.x509StoreName : json('null')) +} + +var upgradeDescription_var = { + deltaHealthPolicy: { + applicationDeltaHealthPolicies: (!empty(upgradeDescription) ? upgradeDescription.applicationDeltaHealthPolicies : json('null')) + maxPercentDeltaUnhealthyApplications: (!empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyApplications : json('null')) + maxPercentDeltaUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyNodes : json('null')) + maxPercentUpgradeDomainDeltaUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.maxPercentUpgradeDomainDeltaUnhealthyNodes : json('null')) + } + forceRestart: '${(!empty(upgradeDescription) ? upgradeDescription.forceRestart : json('null'))}' + healthCheckRetryTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckRetryTimeout : json('null'))}' + healthCheckStableDuration: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckStableDuration : json('null'))}' + healthCheckWaitDuration: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckWaitDuration : json('null'))}' + healthPolicy: { + applicationHealthPolicies: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.applicationHealthPolicies : json('null')) + maxPercentUnhealthyApplications: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : json('null')) + maxPercentUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : json('null')) + upgradeDomainTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeDomainTimeout : json('null'))}' + upgradeReplicaSetCheckTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeReplicaSetCheckTimeout : json('null'))}' + upgradeTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeTimeout : json('null'))}' + } +} + +var builtInRoleNames = { + 'Owner': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635') + 'Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c') + 'Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'acdd72a7-3385-48ef-bd42-f606fba81ae7') + 'Log Analytics Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '92aaf0da-9dab-42b6-94a3-d43ce8d16293') + 'Log Analytics Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '73c42c96-874c-492b-b04d-ab87d138a893') + 'Managed Application Contributor Role': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '641177b8-a67a-45b9-a033-47bc880bb21e') + 'Managed Application Operator Role': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'c7393b34-138c-406f-901b-d8cf2b17e6ae') + 'Managed Applications Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b9331d33-8a36-4f8c-b097-4f54124fdb44') + 'Monitoring Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '749f88d5-cbae-40b8-bcfc-e573ddc772fa') + 'Monitoring Metrics Publisher': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '3913510d-42f4-4e42-8a64-420c390055eb') + 'Monitoring Reader': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '43d0d8ad-25c7-4714-9337-8ba259a9fe05') + 'Resource Policy Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '36243c78-bf99-498c-9df9-86d9f8d28608') + 'User Access Administrator': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '18d7d88d-d35e-4fb5-a5c3-7773c20a72d9') +} module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { name: 'pid-${cuaId}' @@ -185,26 +281,25 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { certificateCommonNames: (!empty(certificateCommonNames) ? certificateCommonNames_var : json('null')) clientCertificateCommonNames: (!empty(clientCertificateCommonNames) ? clientCertificateCommonNames_var : json('null')) clientCertificateThumbprints: (!empty(clientCertificateThumbprints) ? clientCertificateThumbprints_var : json('null')) - clusterCodeVersion: (!empty(clusterCodeVersion) ? clusterCodeVersion : json('null')) - - diagnosticsStorageAccountConfig: diagnosticsStorageAccountConfig + clusterCodeVersion: '${(!empty(clusterCodeVersion) ? clusterCodeVersion : json('null'))}' + diagnosticsStorageAccountConfig: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig_var : json('null')) eventStoreServiceEnabled: eventStoreServiceEnabled - fabricSettings: fabricSettings + fabricSettings: (!empty(fabricSettings) ? fabricSettings_var : json('null')) infrastructureServiceManager: infrastructureServiceManager - managementEndpoint: managementEndpoint - nodeTypes: nodeTypes - notifications: notifications + managementEndpoint: '${(!empty(managementEndpoint) ? managementEndpoint : json('null'))}' + nodeTypes: nodeTypes_var + notifications: (!empty(notifications) ? notifications_var : json('null')) reliabilityLevel: reliabilityLevel - reverseProxyCertificate: reverseProxyCertificate - reverseProxyCertificateCommonNames: reverseProxyCertificateCommonNames - sfZonalUpgradeMode: sfZonalUpgradeMode - upgradeDescription: upgradeDescription - upgradeMode: upgradeMode - upgradePauseEndTimestampUtc: upgradePauseEndTimestampUtc - upgradePauseStartTimestampUtc: upgradePauseStartTimestampUtc - upgradeWave: upgradeWave - vmImage: vmImage - vmssZonalUpgradeMode: vmssZonalUpgradeMode + reverseProxyCertificate: (!empty(reverseProxyCertificate) ? reverseProxyCertificate_var : json('null')) + reverseProxyCertificateCommonNames: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames_var : json('null')) + sfZonalUpgradeMode: (!empty(sfZonalUpgradeMode) ? sfZonalUpgradeMode : json('null')) + upgradeDescription: (!empty(upgradeDescription) ? upgradeDescription_var : json('null')) + upgradeMode: (!empty(upgradeMode) ? upgradeMode : json('null')) + upgradePauseEndTimestampUtc: (!empty(upgradePauseEndTimestampUtc) ? upgradePauseEndTimestampUtc : json('null')) + upgradePauseStartTimestampUtc: (!empty(upgradePauseStartTimestampUtc) ? upgradePauseStartTimestampUtc : json('null')) + upgradeWave: (!empty(upgradeWave) ? upgradeWave : json('null')) + vmImage: (!empty(vmImage) ? vmImage : json('null')) + vmssZonalUpgradeMode: (!empty(vmssZonalUpgradeMode) ? vmssZonalUpgradeMode : json('null')) waveUpgradePaused: waveUpgradePaused } } @@ -219,6 +314,16 @@ resource serviceFabricCluster_lock 'Microsoft.Authorization/locks@2016-09-01' = scope: serviceFabricCluster } +// Service Fabric cluster RBAC assignment +module serviceFabricCluster_rbac './.bicep/nested_rbac.bicep' = [for (roleAssignment, index) in roleAssignments: { + name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-Rbac-${index}' + params: { + roleAssignmentObj: roleAssignment + builtInRoleNames: builtInRoleNames + resourceName: serviceFabricCluster.name + } +}] + // Outputs section output serviceFabricClusterName string = serviceFabricCluster.name output serviceFabricClusterId string = serviceFabricCluster.id diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json index 79bd544aa1..f2db281f9b 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -61,6 +61,62 @@ "certificateThumbprint": "", // If 'clientCertificateThumbprints' is passed then this is mandatory "isAdmin": "" // If 'clientCertificateThumbprints' is passed then this is mandatory }] + }, + "diagnosticsStorageAccountConfig": { + "value": { + "blobEndpoint": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + "protectedAccountKeyName": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + "protectedAccountKeyName2": "", + "queueEndpoint": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + "storageAccountName": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + "tableEndpoint": "" // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + } + }, + "fabricSettings": { + "value": [{ + "name": "", // The section name of the fabric settings. + "parameters": [{ // The collection of parameters in the section. + "name": "", + "value": "" + }] + }] + }, + "managementEndpoint": { + "value": "" // Mandatory + }, + "nodeTypes": { // The list of node types in the cluster. + "value": [{ + "applicationPorts": { + "endPort": "", + "startPort": "" + }, + "capacities": {}, + "clientConnectionEndpointPort": "", + "durabilityLevel": "", // One of 'Bronze', 'Gold', 'Silver' + "ephemeralPorts": { + "endPort": "", + "startPort": "" + }, + "httpGatewayEndpointPort": "", + "isPrimary": "", + "isStateless": "", + "multipleAvailabilityZones": "", + "name": "", + "placementProperties": {}, + "reverseProxyEndpointPort": "", + "vmInstanceCount": "" + }] + }, + "notifications": { + "value": [{ + "isEnabled": "", + "notificationCategory": "", // 'WaveProgress' + "notificationLevel": "", // One of 'All', 'Critical' + "notificationTargets": [{ + "notificationChannel": "", // One of 'EmailSubscription', 'EmailUser' + "receivers": "" + }] + }] } } } From 177fee84416639285e88313badbb42167a97aa83 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 20 Oct 2021 14:34:18 +0530 Subject: [PATCH 06/50] Update bicep and param files. --- .../clusters/deploy.bicep | 22 +++++++++ .../clusters/parameters/parameters.json | 49 +++++++++++++++++++ .../clusters/testbicep.bicep | 3 ++ .../clusters/testbicepparam.json | 12 +++++ 4 files changed, 86 insertions(+) create mode 100644 arm/Microsoft.ServiceFabric/clusters/testbicep.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/testbicepparam.json diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 3742df1747..9494e6ffa5 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -131,6 +131,9 @@ param waveUpgradePaused bool = false @description('Optional. Array of role assignment objects that contain the \'roleDefinitionIdOrName\' and \'principalId\' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or it\'s fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'') param roleAssignments array = [] +@description('Optional. Array of Service Fabric cluster applications.') +param serviceFabricClusterApplications array = [] + // Var section var azureActiveDirectory_var = { clientApplication: (!empty(azureActiveDirectory) ? azureActiveDirectory.clientApplication : json('null')) @@ -324,6 +327,25 @@ module serviceFabricCluster_rbac './.bicep/nested_rbac.bicep' = [for (roleAssign } }] +// Service Fabric cluster applications +resource serviceFabricClusterApplication 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = [for (application, index) in serviceFabricClusterApplications: if (!empty(serviceFabricClusterApplications)) { + name: application[index].name + location: location + tags: tags + identity: (!empty(application[index].identity) ? application[index] : json('null')) + properties: { + managedIdentities: (!empty(application[index].managedIdentities) ? application[index].managedIdentities : json('null')) + maximumNodes: (!empty(application[index].maximumNodes) ? application[index].maximumNodes : null) + metrics: (!empty(application[index].metrics) ? application[index].metrics : json('null')) + minimumNodes: (!empty(application[index].minimumNodes) ? application[index].minimumNodes : null) + parameters: (!empty(application[index].parameters) ? application[index].parameters : json('null')) + removeApplicationCapacity: (!empty(application[index].removeApplicationCapacity) ? application[index].removeApplicationCapacity : null) + typeName: (!empty(application[index].typeName) ? application[index].typeName : null) + typeVersion: (!empty(application[index].typeVersion) ? application[index].typeVersion : null) + upgradePolicy: (!empty(application[index].upgradePolicy) ? application[index].upgradePolicy : json('null')) + } +}] + // Outputs section output serviceFabricClusterName string = serviceFabricCluster.name output serviceFabricClusterId string = serviceFabricCluster.id diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json index f2db281f9b..6dbdb15a16 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -117,6 +117,55 @@ "receivers": "" }] }] + }, + "serviceFabricClusterApplications": { + "value": [{ + "name": "", + "identity": { + "type": "", + "userAssignedIdentities": {} + }, + "managedIdentities": [{ + "name": "", + "principalId": "" + }], + "maximumNodes": "", + "metrics": [{ + "maximumCapacity": "", + "name": "", + "reservationCapacity": "", + "totalApplicationCapacity": "" + }], + "minimumNodes": "", + "parameters": {}, + "removeApplicationCapacity": "", + "typeName": "", + "typeVersion": "", + "upgradePolicy": { + "applicationHealthPolicy": { + "considerWarningAsError": "", + "defaultServiceTypeHealthPolicy": { + "maxPercentUnhealthyPartitionsPerService": "", + "maxPercentUnhealthyReplicasPerPartition": "", + "maxPercentUnhealthyServices": "" + }, + "maxPercentUnhealthyDeployedApplications": "", + "serviceTypeHealthPolicyMap": {} + }, + "forceRestart": "", + "recreateApplication": "", + "rollingUpgradeMonitoringPolicy": { + "failureAction": "", + "healthCheckRetryTimeout": "", + "healthCheckStableDuration": "", + "healthCheckWaitDuration": "", + "upgradeDomainTimeout": "", + "upgradeTimeout": "" + }, + "upgradeMode": "", + "upgradeReplicaSetCheckTimeout": "" + } + }] } } } diff --git a/arm/Microsoft.ServiceFabric/clusters/testbicep.bicep b/arm/Microsoft.ServiceFabric/clusters/testbicep.bicep new file mode 100644 index 0000000000..fdbc61156c --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/testbicep.bicep @@ -0,0 +1,3 @@ +param testArray object + +output testArrayObject bool = empty(testArray.object1) diff --git a/arm/Microsoft.ServiceFabric/clusters/testbicepparam.json b/arm/Microsoft.ServiceFabric/clusters/testbicepparam.json new file mode 100644 index 0000000000..962924d17e --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/testbicepparam.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "testArray": { + "value": { + "Object1": null, + "Object2": "object2Value" + } + } + } +} From bac61212c7688d4637138dffbdb9a6b8e827e16b Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 20 Oct 2021 14:35:13 +0530 Subject: [PATCH 07/50] Remove unwanted files. --- arm/Microsoft.ServiceFabric/clusters/testbicep.bicep | 3 --- .../clusters/testbicepparam.json | 12 ------------ 2 files changed, 15 deletions(-) delete mode 100644 arm/Microsoft.ServiceFabric/clusters/testbicep.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/testbicepparam.json diff --git a/arm/Microsoft.ServiceFabric/clusters/testbicep.bicep b/arm/Microsoft.ServiceFabric/clusters/testbicep.bicep deleted file mode 100644 index fdbc61156c..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/testbicep.bicep +++ /dev/null @@ -1,3 +0,0 @@ -param testArray object - -output testArrayObject bool = empty(testArray.object1) diff --git a/arm/Microsoft.ServiceFabric/clusters/testbicepparam.json b/arm/Microsoft.ServiceFabric/clusters/testbicepparam.json deleted file mode 100644 index 962924d17e..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/testbicepparam.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "testArray": { - "value": { - "Object1": null, - "Object2": "object2Value" - } - } - } -} From d89c07be333715b72da1da60dfd99cd470b06999 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 20 Oct 2021 16:26:28 +0530 Subject: [PATCH 08/50] Update deploy and param file and add nested applicationServices and applicationTypesVersions bicep files. --- .../nested_applicationTypesVersions.bicep | 14 ++ .../.bicep/nested_applicationsServices.bicep | 14 ++ .../clusters/deploy.bicep | 122 ++++++++++++------ .../clusters/parameters/parameters.json | 20 +++ 4 files changed, 127 insertions(+), 43 deletions(-) create mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep new file mode 100644 index 0000000000..12b14eed66 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep @@ -0,0 +1,14 @@ +param name string +param location string +param tags object +param properties object + +resource serviceFabricClusterApplcationTypesVersion_resource 'Microsoft.ServiceFabric/clusters/applicationTypes/versions@2021-06-01' = { + name: name + location: location + tags: tags + properties: properties +} + +// Output +output serviceFabricClusterApplcationTypesVersionId string = serviceFabricClusterApplcationTypesVersion_resource.id diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep new file mode 100644 index 0000000000..bbb46cec19 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep @@ -0,0 +1,14 @@ +param name string +param location string +param tags object +param properties object + +resource serviceFabricClusterApplicationsServices_resource 'Microsoft.ServiceFabric/clusters/applications/services@2021-06-01' = { + name: name + location: location + tags: tags + properties: properties +} + +// Output +output serviceFabricClusterApplicationsServicesResourceId string = serviceFabricClusterApplicationsServices_resource.id diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 9494e6ffa5..be73c3ad1c 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -1,7 +1,4 @@ -// This file can only be deployed at a resource group scope. -targetScope = 'resourceGroup' - -// Service Fabric cluster resource and lock params +// Params @description('Required. Name of the Serivce Fabric cluster.') param serviceFabricClusterName string = '' @@ -134,6 +131,15 @@ param roleAssignments array = [] @description('Optional. Array of Service Fabric cluster applications.') param serviceFabricClusterApplications array = [] +@description('Optional. Array of Service Fabric cluster applications services.') +param serviceFabricApplicationsServices array = [] + +@description('Optional. Array of Service Fabric cluster application types.') +param serviceFabricApplicationTypes array = [] + +@description('Optional. Array of Service Fabric cluster application types versions.') +param serviceFabricApplicationTypesVersions array = [] + // Var section var azureActiveDirectory_var = { clientApplication: (!empty(azureActiveDirectory) ? azureActiveDirectory.clientApplication : json('null')) @@ -159,12 +165,12 @@ var certificateCommonNames_var = { var clientCertificateCommonNames_var = [for index in range(0, (!empty(clientCertificateCommonNames) ? length(clientCertificateCommonNames) : 0)): { certificateCommonName: (!empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateCommonName}' : json('null')) certificateIssuerThumbprint: (!empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateIssuerThumbprint}' : json('null')) - isAdmin: (!empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].isAdmin}' : json('null')) + isAdmin: (!empty(clientCertificateCommonNames) ? clientCertificateCommonNames[index].isAdmin : null) }] var clientCertificateThumbprints_var = [for index in range(0, (!empty(clientCertificateThumbprints) ? length(clientCertificateThumbprints) : 0)): { certificateThumbprint: (!empty(clientCertificateThumbprints) ? '${clientCertificateThumbprints[index].certificateThumbprint}' : json('null')) - isAdmin: (!empty(clientCertificateThumbprints) ? '${clientCertificateThumbprints[index].isAdmin}' : json('null')) + isAdmin: (!empty(clientCertificateThumbprints) ? clientCertificateThumbprints[index].isAdmin : null) }] var diagnosticsStorageAccountConfig_var = { @@ -188,7 +194,7 @@ var nodeTypes_var = [for index in range(0, (!empty(nodeTypes) ? length(nodeTypes } capacities: (!empty(nodeTypes) ? nodeTypes[index].capacities : json('null')) clientConnectionEndpointPort: (!empty(nodeTypes) ? nodeTypes[index].clientConnectionEndpointPort : json('null')) - durabilityLevel: '${(!empty(nodeTypes) ? nodeTypes[index].durabilityLevel : json('null'))}' + durabilityLevel: '${(!empty(nodeTypes) ? nodeTypes[index].durabilityLevel : null)}' ephemeralPorts: { endPort: (!empty(nodeTypes) ? nodeTypes[index].ephemeralPorts.endPort : json('null')) startPort: (!empty(nodeTypes) ? nodeTypes[index].ephemeralPorts.startPort : json('null')) @@ -197,23 +203,23 @@ var nodeTypes_var = [for index in range(0, (!empty(nodeTypes) ? length(nodeTypes isPrimary: (!empty(nodeTypes) ? nodeTypes[index].isPrimary : json('null')) isStateless: (!empty(nodeTypes) ? nodeTypes[index].isStateless : json('null')) multipleAvailabilityZones: (!empty(nodeTypes) ? nodeTypes[index].multipleAvailabilityZones : json('null')) - name: '${(!empty(nodeTypes) ? nodeTypes[index].name : json('null'))}' + name: '${(!empty(nodeTypes) ? nodeTypes[index].name : null)}' placementProperties: (!empty(nodeTypes) ? nodeTypes[index].placementProperties : json('null')) reverseProxyEndpointPort: (!empty(nodeTypes) ? nodeTypes[index].reverseProxyEndpointPort : json('null')) vmInstanceCount: (!empty(nodeTypes) ? nodeTypes[index].vmInstanceCount : json('null')) }] var notifications_var = [for index in range(0, (!empty(notifications) ? length(notifications) : 0)): { - isEnabled: (!empty(notifications) ? notifications[index].isEnabled : json('null')) + isEnabled: (!empty(notifications) ? notifications[index].isEnabled : null) notificationCategory: (!empty(notifications) ? notifications[index].notificationCategory : json('null')) - notificationLevel: (!empty(notifications) ? notifications[index].notificationLevel : json('null')) + notificationLevel: (!empty(notifications) ? notifications[index].notificationLevel : null) notificationTargets: (!empty(notifications) ? notifications[index].notificationTargets : json('null')) }] var reverseProxyCertificate_var = { thumbprint: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprint : json('null')) thumbprintSecondary: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprintSecondary : json('null')) - x509StoreName: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.x509StoreName : json('null')) + x509StoreName: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.x509StoreName : null) } var reverseProxyCertificateCommonNamesList_var = [for index in range(0, (!empty(reverseProxyCertificateCommonNames) ? length(reverseProxyCertificateCommonNames.commonNames) : 0)): { @@ -222,27 +228,27 @@ var reverseProxyCertificateCommonNamesList_var = [for index in range(0, (!empty( var reverseProxyCertificateCommonNames_var = { commonNames: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNamesList_var : json('null')) - x509StoreName: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames.x509StoreName : json('null')) + x509StoreName: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames.x509StoreName : null) } var upgradeDescription_var = { deltaHealthPolicy: { applicationDeltaHealthPolicies: (!empty(upgradeDescription) ? upgradeDescription.applicationDeltaHealthPolicies : json('null')) - maxPercentDeltaUnhealthyApplications: (!empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyApplications : json('null')) - maxPercentDeltaUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyNodes : json('null')) - maxPercentUpgradeDomainDeltaUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.maxPercentUpgradeDomainDeltaUnhealthyNodes : json('null')) + maxPercentDeltaUnhealthyApplications: (!empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyApplications : null) + maxPercentDeltaUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyNodes : null) + maxPercentUpgradeDomainDeltaUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.maxPercentUpgradeDomainDeltaUnhealthyNodes : null) } forceRestart: '${(!empty(upgradeDescription) ? upgradeDescription.forceRestart : json('null'))}' - healthCheckRetryTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckRetryTimeout : json('null'))}' - healthCheckStableDuration: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckStableDuration : json('null'))}' - healthCheckWaitDuration: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckWaitDuration : json('null'))}' + healthCheckRetryTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckRetryTimeout : null)}' + healthCheckStableDuration: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckStableDuration : null)}' + healthCheckWaitDuration: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckWaitDuration : null)}' healthPolicy: { applicationHealthPolicies: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.applicationHealthPolicies : json('null')) - maxPercentUnhealthyApplications: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : json('null')) - maxPercentUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : json('null')) - upgradeDomainTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeDomainTimeout : json('null'))}' - upgradeReplicaSetCheckTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeReplicaSetCheckTimeout : json('null'))}' - upgradeTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeTimeout : json('null'))}' + maxPercentUnhealthyApplications: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : null) + maxPercentUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : null) + upgradeDomainTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeDomainTimeout : null)}' + upgradeReplicaSetCheckTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeReplicaSetCheckTimeout : null)}' + upgradeTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeTimeout : null)}' } } @@ -284,12 +290,12 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { certificateCommonNames: (!empty(certificateCommonNames) ? certificateCommonNames_var : json('null')) clientCertificateCommonNames: (!empty(clientCertificateCommonNames) ? clientCertificateCommonNames_var : json('null')) clientCertificateThumbprints: (!empty(clientCertificateThumbprints) ? clientCertificateThumbprints_var : json('null')) - clusterCodeVersion: '${(!empty(clusterCodeVersion) ? clusterCodeVersion : json('null'))}' + clusterCodeVersion: '${(!empty(clusterCodeVersion) ? clusterCodeVersion : null)}' diagnosticsStorageAccountConfig: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig_var : json('null')) eventStoreServiceEnabled: eventStoreServiceEnabled fabricSettings: (!empty(fabricSettings) ? fabricSettings_var : json('null')) infrastructureServiceManager: infrastructureServiceManager - managementEndpoint: '${(!empty(managementEndpoint) ? managementEndpoint : json('null'))}' + managementEndpoint: '${(!empty(managementEndpoint) ? managementEndpoint : null)}' nodeTypes: nodeTypes_var notifications: (!empty(notifications) ? notifications_var : json('null')) reliabilityLevel: reliabilityLevel @@ -297,12 +303,12 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { reverseProxyCertificateCommonNames: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames_var : json('null')) sfZonalUpgradeMode: (!empty(sfZonalUpgradeMode) ? sfZonalUpgradeMode : json('null')) upgradeDescription: (!empty(upgradeDescription) ? upgradeDescription_var : json('null')) - upgradeMode: (!empty(upgradeMode) ? upgradeMode : json('null')) - upgradePauseEndTimestampUtc: (!empty(upgradePauseEndTimestampUtc) ? upgradePauseEndTimestampUtc : json('null')) - upgradePauseStartTimestampUtc: (!empty(upgradePauseStartTimestampUtc) ? upgradePauseStartTimestampUtc : json('null')) - upgradeWave: (!empty(upgradeWave) ? upgradeWave : json('null')) - vmImage: (!empty(vmImage) ? vmImage : json('null')) - vmssZonalUpgradeMode: (!empty(vmssZonalUpgradeMode) ? vmssZonalUpgradeMode : json('null')) + upgradeMode: (!empty(upgradeMode) ? upgradeMode : null) + upgradePauseEndTimestampUtc: (!empty(upgradePauseEndTimestampUtc) ? upgradePauseEndTimestampUtc : null) + upgradePauseStartTimestampUtc: (!empty(upgradePauseStartTimestampUtc) ? upgradePauseStartTimestampUtc : null) + upgradeWave: (!empty(upgradeWave) ? upgradeWave : null) + vmImage: (!empty(vmImage) ? vmImage : null) + vmssZonalUpgradeMode: (!empty(vmssZonalUpgradeMode) ? vmssZonalUpgradeMode : null) waveUpgradePaused: waveUpgradePaused } } @@ -328,21 +334,51 @@ module serviceFabricCluster_rbac './.bicep/nested_rbac.bicep' = [for (roleAssign }] // Service Fabric cluster applications -resource serviceFabricClusterApplication 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = [for (application, index) in serviceFabricClusterApplications: if (!empty(serviceFabricClusterApplications)) { - name: application[index].name +resource serviceFabricClusterApplication_resource 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = [for application in serviceFabricClusterApplications: if (!empty(serviceFabricClusterApplications)) { + name: application.name location: location tags: tags - identity: (!empty(application[index].identity) ? application[index] : json('null')) + identity: (!empty(application.identity) ? application.identity : json('null')) properties: { - managedIdentities: (!empty(application[index].managedIdentities) ? application[index].managedIdentities : json('null')) - maximumNodes: (!empty(application[index].maximumNodes) ? application[index].maximumNodes : null) - metrics: (!empty(application[index].metrics) ? application[index].metrics : json('null')) - minimumNodes: (!empty(application[index].minimumNodes) ? application[index].minimumNodes : null) - parameters: (!empty(application[index].parameters) ? application[index].parameters : json('null')) - removeApplicationCapacity: (!empty(application[index].removeApplicationCapacity) ? application[index].removeApplicationCapacity : null) - typeName: (!empty(application[index].typeName) ? application[index].typeName : null) - typeVersion: (!empty(application[index].typeVersion) ? application[index].typeVersion : null) - upgradePolicy: (!empty(application[index].upgradePolicy) ? application[index].upgradePolicy : json('null')) + managedIdentities: (!empty(application.managedIdentities) ? application.managedIdentities : json('null')) + maximumNodes: (!empty(application.maximumNodes) ? application.maximumNodes : null) + metrics: (!empty(application.metrics) ? application.metrics : json('null')) + minimumNodes: (!empty(application.minimumNodes) ? application.minimumNodes : null) + parameters: (!empty(application.parameters) ? application.parameters : json('null')) + removeApplicationCapacity: (!empty(application.removeApplicationCapacity) ? application.removeApplicationCapacity : null) + typeName: (!empty(application.typeName) ? application.typeName : null) + typeVersion: (!empty(application.typeVersion) ? application.typeVersion : null) + upgradePolicy: (!empty(application.upgradePolicy) ? application.upgradePolicy : json('null')) + } +}] + +// Service Fabric cluster applications services +module serviceFabricClusterApplications_services '.bicep/nested_applicationsServices.bicep' = [for (applicationsService, index) in serviceFabricApplicationsServices: { + name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-ApplicationsService-${index}' + params: { + name: applicationsService.name + location: location + tags: tags + properties: (!empty(applicationsService.properties) ? applicationsService.properties : json('null')) + } +}] + +// Service Fabric cluster application types +resource serviceFabricClusterApplicationTypes_resource 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = [for applicationType in serviceFabricApplicationTypes: if (!empty(serviceFabricApplicationTypes)) { + name: applicationType.name + location: location + tags: tags + properties: (!empty(applicationType.properties) ? applicationType.properties : json('null')) +}] + +// Service Fabric cluster application types versions +module serviceFabricClusterApplicationTypes_versions '.bicep/nested_applicationTypesVersions.bicep' = [for (applicationTypesVersion, index) in serviceFabricApplicationTypesVersions: if (!empty(serviceFabricApplicationTypesVersions)) { + name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-ApplicationTypesVersion-${index}' + params: { + name: applicationTypesVersion.name + location: location + tags: tags + properties: (!empty(applicationTypesVersion.properties) ? applicationTypesVersion.properties : json('null')) } }] diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json index 6dbdb15a16..872b3adb64 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -166,6 +166,26 @@ "upgradeReplicaSetCheckTimeout": "" } }] + }, + "serviceFabricApplicationTypes": { + "value": { + "name": "", + "properties": {} + } + }, + "serviceFabricApplicationTypesVersions": { + "value": [{ + "name": "", + "properties": { + "appPackageUrl": "" + } + }] + }, + "serviceFabricApplicationsServices": { + "value": [{ + "name": "", + "properties": "" + }] } } } From ef8130807f9b22d693817c14a311cbf01f622041 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 20 Oct 2021 19:28:24 +0530 Subject: [PATCH 09/50] Add workflow and update README.md. --- .../workflows/ms.servicefabric.clusters.yml | 182 ++++++++++++++++++ README.md | 3 +- 2 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ms.servicefabric.clusters.yml diff --git a/.github/workflows/ms.servicefabric.clusters.yml b/.github/workflows/ms.servicefabric.clusters.yml new file mode 100644 index 0000000000..b64c870782 --- /dev/null +++ b/.github/workflows/ms.servicefabric.clusters.yml @@ -0,0 +1,182 @@ +name: "Service Fabric: Clusters" + +on: + workflow_dispatch: + inputs: + removeDeployment: + description: 'Remove deployed module' + required: false + default: 'true' + versioningOption: + description: 'The mode to handle the version increments [major|minor|patch|custom]' + required: false + default: 'patch' + customVersion: + description: 'The version to enforce if [versionOption] is set to [custom]' + required: false + default: '0.0.1' + +env: + moduleName: 'clusters' + modulePath: 'arm/Microsoft.ServiceFabric/clusters' + AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} + ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} + ARM_MGMTGROUP_ID: ${{ secrets.ARM_MGMTGROUP_ID }} + +jobs: + ################## + # UNIT TESTS # + ################## + # Global tests + # ------------ + job_tests_module_global: + runs-on: ubuntu-20.04 + name: "Run global module tests" + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: "Test module" + uses: ./.github/actions/templates/validateModuleGeneral + with: + modulePath: '${{ env.modulePath }}' + moduleName: '${{ env.moduleName}}' + + # Global API tests + # ---------------- + job_tests_module_global_api: + runs-on: ubuntu-20.04 + name: "Run global API module tests" + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: "Test module" + uses: ./.github/actions/templates/validateModuleApis + with: + modulePath: '${{ env.modulePath }}' + moduleName: '${{ env.moduleName}}' + + # Validate deployment module tests + # -------------------------------- + job_tests_module_deploy_validate: + runs-on: ubuntu-20.04 + name: "Run deployment validation module tests" + strategy: + fail-fast: false + matrix: + parameterFilePaths: ['parameters.json'] + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set environment variables + uses: deep-mm/set-variables@v1.0 + with: + # Name of variable file + variableFileName: 'variables.module' # Don't write .json here + - name: "Test module" + uses: ./.github/actions/templates/validateModuleDeploy + with: + templateFilePath: '${{ env.modulePath }}/deploy.bicep' + parameterFilePath: '${{ env.modulePath }}/parameters/${{ matrix.parameterFilePaths }}' + location: '${{ env.defaultLocation }}' + resourceGroupName: '${{ env.resourceGroupName }}' + subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' + managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' + + #################### + # DEPLOY TESTS # + #################### + job_deploy_module: + runs-on: ubuntu-20.04 + name: "Deploy module" + needs: + - job_tests_module_global + - job_tests_module_global_api + - job_tests_module_deploy_validate + strategy: + fail-fast: false + matrix: + parameterFilePaths: ['parameters.json'] + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set environment variables + uses: deep-mm/set-variables@v1.0 + with: + # Name of variable file + variableFileName: 'variables.module' # Don't write .json here + - name: "Deploy module" + uses: ./.github/actions/templates/deployModule + with: + moduleName: '${{ env.moduleName }}' + templateFilePath: '${{ env.modulePath }}/deploy.bicep' + parameterFilePath: '${{ env.modulePath }}/parameters/${{ matrix.parameterFilePaths }}' + location: '${{ env.defaultLocation }}' + resourceGroupName: '${{ env.resourceGroupName }}' + subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' + managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' + removeDeployment: '${{ github.event.inputs.removeDeployment }}' + + ############### + # PUBLISH # + ############### + job_publish_module: + name: "Publish module" + if: contains(fromJson('["refs/heads/main", "refs/heads/master"]'), github.ref) + runs-on: ubuntu-20.04 + needs: + - job_deploy_module + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set environment variables + uses: deep-mm/set-variables@v1.0 + with: + # Name of variable file + variableFileName: 'variables.module' # Don't write .json here + - name: "Publish module" + uses: ./.github/actions/templates/publishModule + with: + templateFilePath: '${{ env.modulePath }}/deploy.bicep' + componentTemplateSpecRGName: '${{ env.componentTemplateSpecRGName }}' + componentTemplateSpecRGLocation: '${{ env.componentTemplateSpecRGLocation }}' + componentTemplateSpecName: '${{ env.moduleName }}' + componentTemplateSpecDescription: '${{ env.componentTemplateSpecDescription }}' + publishToTemplateSpec: '${{ env.publishToTemplateSpec }}' + versioningOption: '${{ github.event.inputs.versioningOption }}' + customVersion: '${{ github.event.inputs.customVersion }}' + + ############## + # REMOVE # + ############## + job_remove_module: + runs-on: ubuntu-20.04 + name: "Remove module" + if: ${{ always() && !cancelled() && github.event.inputs.removeDeployment == 'true' && (contains(needs.*.result, 'success') || contains(needs.*.result, 'failure')) }} + needs: + - job_deploy_module + steps: + - name: "Checkout" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set environment variables + uses: deep-mm/set-variables@v1.0 + with: + # Name of variable file + variableFileName: 'variables.module' # Don't write .json here + - name: "Remove module" + uses: ./.github/actions/templates/removeModule + with: + moduleName: '${{ env.moduleName }}' + templateFilePath: '${{ env.modulePath }}/deploy.bicep' + resourceGroupName: '${{ env.resourceGroupName }}' diff --git a/README.md b/README.md index 55cd961fc7..1161fb33ad 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ This repository includes a collection of advanced and curated Modules consisting | [Scheduled Query Rules](https://github.com/Azure/ResourceModules/tree/main/arm/Microsoft.Insights/scheduledQueryRules) | :heavy_check_mark: | [![Insights: Scheduledqueryrules](https://github.com/Azure/ResourceModules/actions/workflows/ms.insights.scheduledqueryrules.yml/badge.svg)](https://github.com/Azure/ResourceModules/actions/workflows/ms.insights.scheduledqueryrules.yml) | | [ServiceBusNamespaces](https://github.com/Azure/ResourceModules/tree/main/arm/Microsoft.ServiceBus/namespaces) | :heavy_check_mark: | [![ServiceBus: Namespaces](https://github.com/Azure/ResourceModules/actions/workflows/ms.servicebus.namespaces.yml/badge.svg)](https://github.com/Azure/ResourceModules/actions/workflows/ms.servicebus.namespaces.yml) | | [ServiceBusQueues](https://github.com/Azure/ResourceModules/tree/main/arm/Microsoft.ServiceBus/namespacesResources/queues) | :heavy_check_mark: | [![ServiceBus: Namespaces Queues](https://github.com/Azure/ResourceModules/actions/workflows/ms.servicebus.namespaces.queues.yml/badge.svg)](https://github.com/Azure/ResourceModules/actions/workflows/ms.servicebus.namespaces.queues.yml) | +| [Service Fabric Clusters](https://github.com/Azure/ResourceModules/tree/main/arm/Microsoft.ServiceFabric/clusters) | :heavy_check_mark: | [![ServiceFabric: Clusters](https://github.com/Azure/ResourceModules/actions/workflows/ms.servicefabric.clusters.yml/badge.svg)](https://github.com/Azure/ResourceModules/actions/workflows/ms.servicefabric.clusters.yml) | | [Shared Image Definition](https://github.com/Azure/ResourceModules/tree/main/arm/Microsoft.Compute/galleriesResources/images) | :heavy_check_mark: | [![Compute: Galleries Images](https://github.com/Azure/ResourceModules/actions/workflows/ms.compute.galleries.images.yml/badge.svg)](https://github.com/Azure/ResourceModules/actions/workflows/ms.compute.galleries.images.yml) | | [Shared Image Gallery](https://github.com/Azure/ResourceModules/tree/main/arm/Microsoft.Compute/galleries) | :heavy_check_mark: | [![Compute: Galleries](https://github.com/Azure/ResourceModules/actions/workflows/ms.compute.galleries.yml/badge.svg)](https://github.com/Azure/ResourceModules/actions/workflows/ms.compute.galleries.yml) | | [Software Update Configuration](https://github.com/Azure/ResourceModules/tree/main/arm/Microsoft.Automation/automationAccountsResources/softwareUpdateConfigurations) | :heavy_check_mark: | [![Automation: Automationaccounts Softwareupdateconfigurations](https://github.com/Azure/ResourceModules/actions/workflows/ms.automation.automationaccounts.softwareupdateconfigurations.yml/badge.svg)](https://github.com/Azure/ResourceModules/actions/workflows/ms.automation.automationaccounts.softwareupdateconfigurations.yml) | @@ -186,4 +187,4 @@ Any use of third-party trademarks or logos are subject to those third-party's po [MicrosoftAzureDocs]: -[PowerShellDocs]: \ No newline at end of file +[PowerShellDocs]: From 935f4a3dd16ed4c7215cdd3f79f5e08ac1d49b13 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Fri, 22 Oct 2021 16:47:46 +0530 Subject: [PATCH 10/50] Process review comments. --- .../workflows/ms.servicefabric.clusters.yml | 84 +++++++++++++------ .../nested_applicationTypesVersions.bicep | 4 +- .../.bicep/nested_applicationsServices.bicep | 4 +- .../clusters/deploy.bicep | 27 +++--- .../clusters/parameters/parameters.json | 4 +- 5 files changed, 79 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ms.servicefabric.clusters.yml b/.github/workflows/ms.servicefabric.clusters.yml index b64c870782..70a378740a 100644 --- a/.github/workflows/ms.servicefabric.clusters.yml +++ b/.github/workflows/ms.servicefabric.clusters.yml @@ -1,4 +1,4 @@ -name: "Service Fabric: Clusters" +name: 'Service Fabric: Clusters' on: workflow_dispatch: @@ -15,15 +15,45 @@ on: description: 'The version to enforce if [versionOption] is set to [custom]' required: false default: '0.0.1' + push: + branches: + - main + paths: + - '.github/actions/templates/**' + - '.github/workflows/ms.servicefabric.clusters.yml' + - 'arm/Microsoft.ServiceFabric/clusters/**' + - '!arm/Microsoft.ServiceFabric/clusters/readme.md' env: moduleName: 'clusters' modulePath: 'arm/Microsoft.ServiceFabric/clusters' + workflowPath: '.github/workflows/ms.servicefabric.clusters.yml' AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} ARM_MGMTGROUP_ID: ${{ secrets.ARM_MGMTGROUP_ID }} jobs: + ############################ + # SET INPUT PARAMETERS # + ############################ + job_set_workflow_param: + runs-on: ubuntu-20.04 + name: 'Set input parameters to output variables' + steps: + - name: 'Checkout' + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: 'Set input parameters' + id: get-workflow-param + uses: ./.github/actions/templates/getWorkflowInput + with: + workflowPath: '${{ env.workflowPath}}' + outputs: + removeDeployment: ${{ steps.get-workflow-param.outputs.removeDeployment }} + versioningOption: ${{ steps.get-workflow-param.outputs.versioningOption }} + customVersion: ${{ steps.get-workflow-param.outputs.customVersion }} + ################## # UNIT TESTS # ################## @@ -31,13 +61,13 @@ jobs: # ------------ job_tests_module_global: runs-on: ubuntu-20.04 - name: "Run global module tests" + name: 'Run global module tests' steps: - - name: "Checkout" + - name: 'Checkout' uses: actions/checkout@v2 with: fetch-depth: 0 - - name: "Test module" + - name: 'Test module' uses: ./.github/actions/templates/validateModuleGeneral with: modulePath: '${{ env.modulePath }}' @@ -47,13 +77,13 @@ jobs: # ---------------- job_tests_module_global_api: runs-on: ubuntu-20.04 - name: "Run global API module tests" + name: 'Run global API module tests' steps: - - name: "Checkout" + - name: 'Checkout' uses: actions/checkout@v2 with: fetch-depth: 0 - - name: "Test module" + - name: 'Test module' uses: ./.github/actions/templates/validateModuleApis with: modulePath: '${{ env.modulePath }}' @@ -63,13 +93,13 @@ jobs: # -------------------------------- job_tests_module_deploy_validate: runs-on: ubuntu-20.04 - name: "Run deployment validation module tests" + name: 'Run deployment validation module tests' strategy: fail-fast: false matrix: parameterFilePaths: ['parameters.json'] steps: - - name: "Checkout" + - name: 'Checkout' uses: actions/checkout@v2 with: fetch-depth: 0 @@ -78,7 +108,7 @@ jobs: with: # Name of variable file variableFileName: 'variables.module' # Don't write .json here - - name: "Test module" + - name: 'Test module' uses: ./.github/actions/templates/validateModuleDeploy with: templateFilePath: '${{ env.modulePath }}/deploy.bicep' @@ -93,17 +123,18 @@ jobs: #################### job_deploy_module: runs-on: ubuntu-20.04 - name: "Deploy module" + name: 'Deploy module' needs: - - job_tests_module_global - - job_tests_module_global_api - - job_tests_module_deploy_validate + - job_set_workflow_param + - job_tests_module_global + - job_tests_module_global_api + - job_tests_module_deploy_validate strategy: fail-fast: false matrix: parameterFilePaths: ['parameters.json'] steps: - - name: "Checkout" + - name: 'Checkout' uses: actions/checkout@v2 with: fetch-depth: 0 @@ -112,7 +143,7 @@ jobs: with: # Name of variable file variableFileName: 'variables.module' # Don't write .json here - - name: "Deploy module" + - name: 'Deploy module' uses: ./.github/actions/templates/deployModule with: moduleName: '${{ env.moduleName }}' @@ -122,19 +153,20 @@ jobs: resourceGroupName: '${{ env.resourceGroupName }}' subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' - removeDeployment: '${{ github.event.inputs.removeDeployment }}' + removeDeployment: '${{ needs.job_set_workflow_param.outputs.removeDeployment }}' ############### # PUBLISH # ############### job_publish_module: - name: "Publish module" + name: 'Publish module' if: contains(fromJson('["refs/heads/main", "refs/heads/master"]'), github.ref) runs-on: ubuntu-20.04 needs: + - job_set_workflow_param - job_deploy_module steps: - - name: "Checkout" + - name: 'Checkout' uses: actions/checkout@v2 with: fetch-depth: 0 @@ -143,7 +175,7 @@ jobs: with: # Name of variable file variableFileName: 'variables.module' # Don't write .json here - - name: "Publish module" + - name: 'Publish module' uses: ./.github/actions/templates/publishModule with: templateFilePath: '${{ env.modulePath }}/deploy.bicep' @@ -152,20 +184,20 @@ jobs: componentTemplateSpecName: '${{ env.moduleName }}' componentTemplateSpecDescription: '${{ env.componentTemplateSpecDescription }}' publishToTemplateSpec: '${{ env.publishToTemplateSpec }}' - versioningOption: '${{ github.event.inputs.versioningOption }}' - customVersion: '${{ github.event.inputs.customVersion }}' + versioningOption: '${{ needs.job_set_workflow_param.outputs.versioningOption }}' + customVersion: '${{ needs.job_set_workflow_param.outputs.customVersion }}' ############## # REMOVE # ############## job_remove_module: runs-on: ubuntu-20.04 - name: "Remove module" - if: ${{ always() && !cancelled() && github.event.inputs.removeDeployment == 'true' && (contains(needs.*.result, 'success') || contains(needs.*.result, 'failure')) }} + name: 'Remove module' + if: ${{ always() && !cancelled() && needs.job_set_workflow_param.outputs.removeDeployment == 'true' && (contains(needs.*.result, 'success') || contains(needs.*.result, 'failure')) }} needs: - job_deploy_module steps: - - name: "Checkout" + - name: 'Checkout' uses: actions/checkout@v2 with: fetch-depth: 0 @@ -174,7 +206,7 @@ jobs: with: # Name of variable file variableFileName: 'variables.module' # Don't write .json here - - name: "Remove module" + - name: 'Remove module' uses: ./.github/actions/templates/removeModule with: moduleName: '${{ env.moduleName }}' diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep index 12b14eed66..676eee69cd 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep @@ -3,7 +3,7 @@ param location string param tags object param properties object -resource serviceFabricClusterApplcationTypesVersion_resource 'Microsoft.ServiceFabric/clusters/applicationTypes/versions@2021-06-01' = { +resource version 'Microsoft.ServiceFabric/clusters/applicationTypes/versions@2021-06-01' = { name: name location: location tags: tags @@ -11,4 +11,4 @@ resource serviceFabricClusterApplcationTypesVersion_resource 'Microsoft.ServiceF } // Output -output serviceFabricClusterApplcationTypesVersionId string = serviceFabricClusterApplcationTypesVersion_resource.id +output serviceFabricClusterApplcationTypesVersionId string = version.id diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep index bbb46cec19..fa2b870bef 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep @@ -3,7 +3,7 @@ param location string param tags object param properties object -resource serviceFabricClusterApplicationsServices_resource 'Microsoft.ServiceFabric/clusters/applications/services@2021-06-01' = { +resource service 'Microsoft.ServiceFabric/clusters/applications/services@2021-06-01' = { name: name location: location tags: tags @@ -11,4 +11,4 @@ resource serviceFabricClusterApplicationsServices_resource 'Microsoft.ServiceFab } // Output -output serviceFabricClusterApplicationsServicesResourceId string = serviceFabricClusterApplicationsServices_resource.id +output serviceFabricClusterApplicationsServicesResourceId string = service.id diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index be73c3ad1c..4bad2908bd 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -8,8 +8,13 @@ param location string = resourceGroup().location @description('Optional. Tags of the resource.') param tags object = {} -@description('Optional. Switch to lock storage from deletion.') -param lockForDeletion bool = false +@allowed([ + 'CanNotDelete' + 'NotSpecified' + 'ReadOnly' +]) +@description('Optional. Specify the type of lock.') +param lock string = 'NotSpecified' @description('Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered') param cuaId string = '' @@ -280,11 +285,9 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { tags: tags properties: { addOnFeatures: addOnFeatures - applicationTypeVersionsCleanupPolicy: { maxUnusedVersionsToKeep: maxUnusedVersionsToKeep } - azureActiveDirectory: (!empty(azureActiveDirectory) ? azureActiveDirectory_var : json('null')) certificate: (!empty(certificate) ? certificate_var : json('null')) certificateCommonNames: (!empty(certificateCommonNames) ? certificateCommonNames_var : json('null')) @@ -314,11 +317,11 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { } // Service Fabric cluster resource lock -resource serviceFabricCluster_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lockForDeletion) { - name: '${serviceFabricCluster.name}-doNotDelete' +resource serviceFabricCluster_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lock != 'NotSpecified') { + name: '${serviceFabricCluster.name}-${lock}-lock' properties: { - level: 'CanNotDelete' - notes: 'Do not delete!' + level: lock + notes: (lock == 'CanNotDelete') ? 'Cannot delete resource or child resources.' : 'Cannot modify the resource or child resources.' } scope: serviceFabricCluster } @@ -334,7 +337,7 @@ module serviceFabricCluster_rbac './.bicep/nested_rbac.bicep' = [for (roleAssign }] // Service Fabric cluster applications -resource serviceFabricClusterApplication_resource 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = [for application in serviceFabricClusterApplications: if (!empty(serviceFabricClusterApplications)) { +resource serviceFabricCluster_applications 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = [for application in serviceFabricClusterApplications: { name: application.name location: location tags: tags @@ -353,7 +356,7 @@ resource serviceFabricClusterApplication_resource 'Microsoft.ServiceFabric/clust }] // Service Fabric cluster applications services -module serviceFabricClusterApplications_services '.bicep/nested_applicationsServices.bicep' = [for (applicationsService, index) in serviceFabricApplicationsServices: { +module serviceFabricCluster_applicationServices '.bicep/nested_applicationsServices.bicep' = [for (applicationsService, index) in serviceFabricApplicationsServices: { name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-ApplicationsService-${index}' params: { name: applicationsService.name @@ -364,7 +367,7 @@ module serviceFabricClusterApplications_services '.bicep/nested_applicationsServ }] // Service Fabric cluster application types -resource serviceFabricClusterApplicationTypes_resource 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = [for applicationType in serviceFabricApplicationTypes: if (!empty(serviceFabricApplicationTypes)) { +resource serviceFabricCluster_applicationTypes 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = [for applicationType in serviceFabricApplicationTypes: { name: applicationType.name location: location tags: tags @@ -372,7 +375,7 @@ resource serviceFabricClusterApplicationTypes_resource 'Microsoft.ServiceFabric/ }] // Service Fabric cluster application types versions -module serviceFabricClusterApplicationTypes_versions '.bicep/nested_applicationTypesVersions.bicep' = [for (applicationTypesVersion, index) in serviceFabricApplicationTypesVersions: if (!empty(serviceFabricApplicationTypesVersions)) { +module serviceFabricCluster_applicationTypeVersions '.bicep/nested_applicationTypesVersions.bicep' = [for (applicationTypesVersion, index) in serviceFabricApplicationTypesVersions: { name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-ApplicationTypesVersion-${index}' params: { name: applicationTypesVersion.name diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json index 872b3adb64..1ef04cad29 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -15,8 +15,8 @@ "contactinfo": "someone@company.com" } }, - "lockForDeletion": { - "value": false + "lock": { + "value": "CanNotDelete" }, "addOnFeatures": { "value": [] From 513444184cb9e8d7276c12906a6fb8a2da1e43e4 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Tue, 26 Oct 2021 23:52:34 +0530 Subject: [PATCH 11/50] Update Service fabric bicep module with updated child modules. --- .../.bicep/nested_applicationTypes.bicep | 22 ++ .../nested_applicationTypesVersions.bicep | 14 - .../clusters/.bicep/nested_applications.bicep | 24 ++ .../.bicep/nested_applicationsServices.bicep | 14 - .../clusters/deploy.bicep | 113 +++--- .../clusters/parameters/parameters.json | 350 ++++++++++-------- 6 files changed, 293 insertions(+), 244 deletions(-) create mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep new file mode 100644 index 0000000000..53d90ea004 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep @@ -0,0 +1,22 @@ +param applicationType object +param clusterName string +param location string +param tags object +param properties object + +resource applicationTypes 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = { + name: '${clusterName}/applicationTypes-${applicationType.name}' + location: location + tags: tags + properties: properties + + resource versions 'versions@2021-06-01' = [for version in applicationType.applicationTypesVersions: { + name: version.name + location: location + tags: tags + properties: (!empty(version.properties) ? version.properties : json('null')) + }] +} + +// Output +output serviceFabricClusterApplcationTypesId string = applicationTypes.id diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep deleted file mode 100644 index 676eee69cd..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypesVersions.bicep +++ /dev/null @@ -1,14 +0,0 @@ -param name string -param location string -param tags object -param properties object - -resource version 'Microsoft.ServiceFabric/clusters/applicationTypes/versions@2021-06-01' = { - name: name - location: location - tags: tags - properties: properties -} - -// Output -output serviceFabricClusterApplcationTypesVersionId string = version.id diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep new file mode 100644 index 0000000000..1e1c8d9277 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep @@ -0,0 +1,24 @@ +param applicationObj object +param clusterName string +param location string +param tags object +param identity object +param properties object + +resource application 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = { + name: '${clusterName}/application-${applicationObj.name}' + location: location + tags: tags + identity: identity + properties: properties + + resource services 'services@2021-06-01' = [for service in applicationObj.applicationsServices: { + name: service.name + location: location + tags: tags + properties: (!empty(service.properties) ? service.properties : json('null')) + }] +} + +// Output +output serviceFabricClusterApplicationsServicesResourceId string = application.id diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep deleted file mode 100644 index fa2b870bef..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationsServices.bicep +++ /dev/null @@ -1,14 +0,0 @@ -param name string -param location string -param tags object -param properties object - -resource service 'Microsoft.ServiceFabric/clusters/applications/services@2021-06-01' = { - name: name - location: location - tags: tags - properties: properties -} - -// Output -output serviceFabricClusterApplicationsServicesResourceId string = service.id diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 4bad2908bd..c5713e8375 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -47,7 +47,7 @@ param clientCertificateCommonNames array = [] param clientCertificateThumbprints array = [] @description('Optional. The Service Fabric runtime version of the cluster. This property can only by set the user when upgradeMode is set to "Manual". To get list of available Service Fabric versions for new clusters use ClusterVersion API. To get the list of available version for existing clusters use availableClusterVersions.') -param clusterCodeVersion string = '' +param clusterCodeVersion string @description('Optional. The storage account information for storing Service Fabric diagnostic logs.') param diagnosticsStorageAccountConfig object = {} @@ -136,15 +136,9 @@ param roleAssignments array = [] @description('Optional. Array of Service Fabric cluster applications.') param serviceFabricClusterApplications array = [] -@description('Optional. Array of Service Fabric cluster applications services.') -param serviceFabricApplicationsServices array = [] - @description('Optional. Array of Service Fabric cluster application types.') param serviceFabricApplicationTypes array = [] -@description('Optional. Array of Service Fabric cluster application types versions.') -param serviceFabricApplicationTypesVersions array = [] - // Var section var azureActiveDirectory_var = { clientApplication: (!empty(azureActiveDirectory) ? azureActiveDirectory.clientApplication : json('null')) @@ -192,26 +186,26 @@ var fabricSettings_var = [for index in range(0, (!empty(fabricSettings) ? length parameters: (!empty(fabricSettings) ? fabricSettings[index].parameters : json('null')) }] -var nodeTypes_var = [for index in range(0, (!empty(nodeTypes) ? length(nodeTypes) : 0)): { - applicationPorts: { - endPort: (!empty(nodeTypes) ? nodeTypes[index].applicationPorts.endPort : json('null')) - startPort: (!empty(nodeTypes) ? nodeTypes[index].applicationPorts.startPort : json('null')) - } - capacities: (!empty(nodeTypes) ? nodeTypes[index].capacities : json('null')) - clientConnectionEndpointPort: (!empty(nodeTypes) ? nodeTypes[index].clientConnectionEndpointPort : json('null')) - durabilityLevel: '${(!empty(nodeTypes) ? nodeTypes[index].durabilityLevel : null)}' - ephemeralPorts: { - endPort: (!empty(nodeTypes) ? nodeTypes[index].ephemeralPorts.endPort : json('null')) - startPort: (!empty(nodeTypes) ? nodeTypes[index].ephemeralPorts.startPort : json('null')) - } - httpGatewayEndpointPort: (!empty(nodeTypes) ? nodeTypes[index].httpGatewayEndpointPort : json('null')) - isPrimary: (!empty(nodeTypes) ? nodeTypes[index].isPrimary : json('null')) - isStateless: (!empty(nodeTypes) ? nodeTypes[index].isStateless : json('null')) - multipleAvailabilityZones: (!empty(nodeTypes) ? nodeTypes[index].multipleAvailabilityZones : json('null')) - name: '${(!empty(nodeTypes) ? nodeTypes[index].name : null)}' - placementProperties: (!empty(nodeTypes) ? nodeTypes[index].placementProperties : json('null')) - reverseProxyEndpointPort: (!empty(nodeTypes) ? nodeTypes[index].reverseProxyEndpointPort : json('null')) - vmInstanceCount: (!empty(nodeTypes) ? nodeTypes[index].vmInstanceCount : json('null')) +var nodeTypes_var = [for nodeType in nodeTypes: { + applicationPorts: contains(nodeType, 'applicationPorts') ? { + endPort: (contains(nodeType.applicationPorts, 'endPort') ? nodeType.applicationPorts.endPort : null) + startPort: (contains(nodeType.applicationPorts, 'startPort') ? nodeType.applicationPorts.startPort : null) + } : json('null') + capacities: (contains(nodeType, 'capacities') ? nodeType.capacities : json('null')) + clientConnectionEndpointPort: (contains(nodeType, 'clientConnectionEndpointPort') ? nodeType.clientConnectionEndpointPort : null) + durabilityLevel: (contains(nodeType, 'durabilityLevel') ? nodeType.durabilityLevel : null) + ephemeralPorts: contains(nodeType, 'ephemeralPorts') ? { + endPort: (contains(nodeType.ephemeralPorts, 'endPort') ? nodeType.ephemeralPorts.endPort : null) + startPort: (contains(nodeType.ephemeralPorts, 'startPort') ? nodeType.ephemeralPorts.startPort : null) + } : json('null') + httpGatewayEndpointPort: (contains(nodeType, 'httpGatewayEndpointPort') ? nodeType.httpGatewayEndpointPort : null) + isPrimary: (contains(nodeType, 'isPrimary') ? nodeType.isPrimary : null) + isStateless: (contains(nodeType, 'isStateless') ? nodeType.isStateless : null) + multipleAvailabilityZones: (contains(nodeType, 'multipleAvailabilityZones') ? nodeType.multipleAvailabilityZones : null) + name: '${(!empty(nodeType.name) ? nodeType.name : 'Node00')}' + placementProperties: (contains(nodeType, 'placementProperties') ? nodeType.placementProperties : json('null')) + reverseProxyEndpointPort: (contains(nodeType, 'reverseProxyEndpointPort') ? nodeType.reverseProxyEndpointPort : null) + vmInstanceCount: (contains(nodeType, 'vmInstanceCount') ? nodeType.vmInstanceCount : 1) }] var notifications_var = [for index in range(0, (!empty(notifications) ? length(notifications) : 0)): { @@ -328,7 +322,7 @@ resource serviceFabricCluster_lock 'Microsoft.Authorization/locks@2016-09-01' = // Service Fabric cluster RBAC assignment module serviceFabricCluster_rbac './.bicep/nested_rbac.bicep' = [for (roleAssignment, index) in roleAssignments: { - name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-Rbac-${index}' + name: '${serviceFabricCluster.name}-${uniqueString(deployment().name, location)}-Rbac-${index}' params: { roleAssignmentObj: roleAssignment builtInRoleNames: builtInRoleNames @@ -336,53 +330,42 @@ module serviceFabricCluster_rbac './.bicep/nested_rbac.bicep' = [for (roleAssign } }] -// Service Fabric cluster applications -resource serviceFabricCluster_applications 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = [for application in serviceFabricClusterApplications: { - name: application.name - location: location - tags: tags - identity: (!empty(application.identity) ? application.identity : json('null')) - properties: { - managedIdentities: (!empty(application.managedIdentities) ? application.managedIdentities : json('null')) - maximumNodes: (!empty(application.maximumNodes) ? application.maximumNodes : null) - metrics: (!empty(application.metrics) ? application.metrics : json('null')) - minimumNodes: (!empty(application.minimumNodes) ? application.minimumNodes : null) - parameters: (!empty(application.parameters) ? application.parameters : json('null')) - removeApplicationCapacity: (!empty(application.removeApplicationCapacity) ? application.removeApplicationCapacity : null) - typeName: (!empty(application.typeName) ? application.typeName : null) - typeVersion: (!empty(application.typeVersion) ? application.typeVersion : null) - upgradePolicy: (!empty(application.upgradePolicy) ? application.upgradePolicy : json('null')) - } -}] - -// Service Fabric cluster applications services -module serviceFabricCluster_applicationServices '.bicep/nested_applicationsServices.bicep' = [for (applicationsService, index) in serviceFabricApplicationsServices: { - name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-ApplicationsService-${index}' +// Service Fabric cluster application types +module serviceFabricCluster_applicationTypes '.bicep/nested_applicationTypes.bicep' = [for applicationType in serviceFabricApplicationTypes: { + name: '${serviceFabricCluster.name}-${applicationType.name}' params: { - name: applicationsService.name + applicationType: applicationType + clusterName: serviceFabricCluster.name location: location tags: tags - properties: (!empty(applicationsService.properties) ? applicationsService.properties : json('null')) + properties: (!empty(applicationType.properties) ? applicationType.properties : json('null')) } }] -// Service Fabric cluster application types -resource serviceFabricCluster_applicationTypes 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = [for applicationType in serviceFabricApplicationTypes: { - name: applicationType.name - location: location - tags: tags - properties: (!empty(applicationType.properties) ? applicationType.properties : json('null')) -}] - -// Service Fabric cluster application types versions -module serviceFabricCluster_applicationTypeVersions '.bicep/nested_applicationTypesVersions.bicep' = [for (applicationTypesVersion, index) in serviceFabricApplicationTypesVersions: { - name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-ApplicationTypesVersion-${index}' +// Service Fabric cluster applications +module serviceFabricCluster_applications '.bicep/nested_applications.bicep' = [for application in serviceFabricClusterApplications: { + name: '${serviceFabricCluster.name}-${application.name}' params: { - name: applicationTypesVersion.name + applicationObj: application + clusterName: serviceFabricCluster.name location: location tags: tags - properties: (!empty(applicationTypesVersion.properties) ? applicationTypesVersion.properties : json('null')) + identity: (!empty(application.identity) ? application.identity : json('null')) + properties: { + managedIdentities: (!empty(application.managedIdentities) ? application.managedIdentities : json('null')) + maximumNodes: (contains(application, 'maximumNodes') ? application.maximumNodes : 1) + metrics: (!empty(application.metrics) ? application.metrics : json('null')) + minimumNodes: (contains(application, 'minimumNodes') ? application.minimumNodes : 0) + parameters: (!empty(application.parameters) ? application.parameters : json('null')) + removeApplicationCapacity: (contains(application, 'removeApplicationCapacity') ? application.removeApplicationCapacity : false) + typeName: (!empty(application.typeName) ? application.typeName : null) + typeVersion: (!empty(application.typeVersion) ? application.typeVersion : null) + upgradePolicy: (!empty(application.upgradePolicy) ? application.upgradePolicy : json('null')) + } } + dependsOn: [ + serviceFabricCluster_applicationTypes + ] }] // Outputs section diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json index 1ef04cad29..7e372707bb 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -6,7 +6,7 @@ "value": "sxx-az-sfc-weu-x-001" }, "location": { - "value": "centralIndia" + "value": "eastus" }, "tags": { "value": { @@ -15,176 +15,224 @@ "contactinfo": "someone@company.com" } }, - "lock": { - "value": "CanNotDelete" - }, - "addOnFeatures": { - "value": [] - }, - "maxUnusedVersionsToKeep": { - "value": 2 // Mandatory - }, - "azureActiveDirectory": { - "value": { - "clientApplication": "", - "clusterApplication": "", - "tenantId": "" - } - }, - "certificate": { - "value": { - "thumbprint": "", // If 'certificate' is provided then this is mandatory - "thumbprintSecondary": "", - "x509StoreName": "" // Possible values are 'AddressBook', 'AuthRoot', 'CertificateAuthority', 'Disallowed', 'My', 'Root', 'TrustedPeople', 'TrustedPublisher' - } - }, - "certificateCommonNames": { - "value": { - "commonNames": [ // The list of server certificates referenced by common name that are used to secure the cluster. - { - "certificateCommonName": "", // If 'certificateCommonNames' is provided then this is mandatory - "certificateIssuerThumbprint": "" // If 'certificateCommonNames' is provided then this is mandatory - } - ], - "x509StoreName": "" // Possible values are 'AddressBook', 'AuthRoot', 'CertificateAuthority', 'Disallowed', 'My', 'Root', 'TrustedPeople', 'TrustedPublisher' - } - }, - "clientCertificateCommonNames": { - "value": [{ - "certificateCommonName": "", // If 'clientCertificateCommonNames' is passed then this is mandatory - "certificateIssuerThumbprint": "", // If 'clientCertificateCommonNames' is passed then this is mandatory - "isAdmin": "" // Bool. If 'clientCertificateCommonNames' is passed then this is mandatory - }] - }, - "clientCertificateThumbprints": { - "value": [{ - "certificateThumbprint": "", // If 'clientCertificateThumbprints' is passed then this is mandatory - "isAdmin": "" // If 'clientCertificateThumbprints' is passed then this is mandatory - }] - }, - "diagnosticsStorageAccountConfig": { - "value": { - "blobEndpoint": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory - "protectedAccountKeyName": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory - "protectedAccountKeyName2": "", - "queueEndpoint": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory - "storageAccountName": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory - "tableEndpoint": "" // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory - } - }, - "fabricSettings": { - "value": [{ - "name": "", // The section name of the fabric settings. - "parameters": [{ // The collection of parameters in the section. - "name": "", - "value": "" - }] - }] - }, + // "lock": { + // "value": "CanNotDelete" + // }, + // "addOnFeatures": { + // "value": [] + // }, + // "maxUnusedVersionsToKeep": { + // "value": 2 + // }, + // "azureActiveDirectory": { + // "value": { + // "clientApplication": "", + // "clusterApplication": "", + // "tenantId": "" + // } + // }, + // "certificate": { + // "value": { + // "thumbprint": "", // If 'certificate' is provided then this is mandatory + // "thumbprintSecondary": "", + // "x509StoreName": "" // Possible values are 'AddressBook', 'AuthRoot', 'CertificateAuthority', 'Disallowed', 'My', 'Root', 'TrustedPeople', 'TrustedPublisher' + // } + // }, + // "certificateCommonNames": { + // "value": { + // "commonNames": [ // The list of server certificates referenced by common name that are used to secure the cluster. + // { + // "certificateCommonName": "", // If 'certificateCommonNames' is provided then this is mandatory + // "certificateIssuerThumbprint": "" // If 'certificateCommonNames' is provided then this is mandatory + // } + // ], + // "x509StoreName": "" // Possible values are 'AddressBook', 'AuthRoot', 'CertificateAuthority', 'Disallowed', 'My', 'Root', 'TrustedPeople', 'TrustedPublisher' + // } + // }, + // "clientCertificateCommonNames": { + // "value": [{ + // "certificateCommonName": "", // If 'clientCertificateCommonNames' is passed then this is mandatory + // "certificateIssuerThumbprint": "", // If 'clientCertificateCommonNames' is passed then this is mandatory + // "isAdmin": "" // Bool. If 'clientCertificateCommonNames' is passed then this is mandatory + // }] + // }, + // "clientCertificateThumbprints": { + // "value": [{ + // "certificateThumbprint": "", // If 'clientCertificateThumbprints' is passed then this is mandatory + // "isAdmin": "" // If 'clientCertificateThumbprints' is passed then this is mandatory + // }] + // }, + "clusterCodeVersion": { + "value": "8.1.329.9590" + }, + // "diagnosticsStorageAccountConfig": { + // "value": { + // "blobEndpoint": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + // "protectedAccountKeyName": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + // "protectedAccountKeyName2": "", + // "queueEndpoint": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + // "storageAccountName": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + // "tableEndpoint": "" // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory + // } + // }, + // "fabricSettings": { + // "value": [{ + // "name": "", // The section name of the fabric settings. + // "parameters": [{ // The collection of parameters in the section. + // "name": "", + // "value": "" + // }] + // }] + // }, "managementEndpoint": { - "value": "" // Mandatory + "value": "https://sxx-az-sfc-weu-x-050.eastus.cloudapp.azure.com:19080" // Mandatory }, "nodeTypes": { // The list of node types in the cluster. "value": [{ - "applicationPorts": { - "endPort": "", - "startPort": "" - }, - "capacities": {}, - "clientConnectionEndpointPort": "", - "durabilityLevel": "", // One of 'Bronze', 'Gold', 'Silver' - "ephemeralPorts": { - "endPort": "", - "startPort": "" + "applicationPorts": { + "endPort": 30000, + "startPort": 20000 + }, + //"capacities": {}, + "clientConnectionEndpointPort": 19000, + "durabilityLevel": "Silver", // One of 'Bronze', 'Gold', 'Silver' + "ephemeralPorts": { + "endPort": 65534, + "startPort": 49152 + }, + "httpGatewayEndpointPort": 19080, + "isPrimary": true, + // "isStateless": false, + // "multipleAvailabilityZones": false, + "name": "Node01", + // "placementProperties": {}, + // "reverseProxyEndpointPort": "", + "vmInstanceCount": 5 }, - "httpGatewayEndpointPort": "", - "isPrimary": "", - "isStateless": "", - "multipleAvailabilityZones": "", - "name": "", - "placementProperties": {}, - "reverseProxyEndpointPort": "", - "vmInstanceCount": "" - }] - }, - "notifications": { + { + "applicationPorts": { + "endPort": 30000, + "startPort": 20000 + }, + //"capacities": {}, + "clientConnectionEndpointPort": 19090, + "durabilityLevel": "Silver", // One of 'Bronze', 'Gold', 'Silver' + // "ephemeralPorts": { + // "endPort": 65534, + // "startPort": 49152 + // }, + "httpGatewayEndpointPort": 19090, + "isPrimary": false, + // "isStateless": false, + // "multipleAvailabilityZones": false, + "name": "Node02", + // "placementProperties": {}, + // "reverseProxyEndpointPort": "", + "vmInstanceCount": 5 + } + ] + }, + // "notifications": { + // "value": [{ + // "isEnabled": "", + // "notificationCategory": "", // 'WaveProgress' + // "notificationLevel": "", // One of 'All', 'Critical' + // "notificationTargets": [{ + // "notificationChannel": "", // One of 'EmailSubscription', 'EmailUser' + // "receivers": "" + // }] + // }] + // }, + "reliabilityLevel": { + "value": "Silver" + }, + "vmImage": { + "value": "WindowsServer 2016-Datacenter" + }, + "roleAssignments": { "value": [{ - "isEnabled": "", - "notificationCategory": "", // 'WaveProgress' - "notificationLevel": "", // One of 'All', 'Critical' - "notificationTargets": [{ - "notificationChannel": "", // One of 'EmailSubscription', 'EmailUser' - "receivers": "" - }] + "roleDefinitionIdOrName": "Reader", + "principalIds": [ + "5545f7a0-51f4-46af-b3b4-baecf5176a56" + ] }] }, "serviceFabricClusterApplications": { "value": [{ - "name": "", + "name": "serviceFabricClusterApplication01", "identity": { - "type": "", + "type": "None", "userAssignedIdentities": {} }, - "managedIdentities": [{ - "name": "", - "principalId": "" - }], - "maximumNodes": "", - "metrics": [{ - "maximumCapacity": "", - "name": "", - "reservationCapacity": "", - "totalApplicationCapacity": "" - }], - "minimumNodes": "", - "parameters": {}, - "removeApplicationCapacity": "", - "typeName": "", - "typeVersion": "", - "upgradePolicy": { - "applicationHealthPolicy": { - "considerWarningAsError": "", - "defaultServiceTypeHealthPolicy": { - "maxPercentUnhealthyPartitionsPerService": "", - "maxPercentUnhealthyReplicasPerPartition": "", - "maxPercentUnhealthyServices": "" + "properties": { + "managedIdentities": [{ + "name": "Identity_Friendly_Name", + "principalId": "5545f7a0-51f4-46af-b3b4-baecf5176a56" + }], + "maximumNodes": 2, + "metrics": [{ + "maximumCapacity": null, + "name": null, + "reservationCapacity": null, + "totalApplicationCapacity": null + }], + "minimumNodes": null, + "parameters": {}, + "removeApplicationCapacity": "", + "typeName": "DotNetCore", + "typeVersion": "VersionOne", + "upgradePolicy": { + "applicationHealthPolicy": { + "considerWarningAsError": "", + "defaultServiceTypeHealthPolicy": { + "maxPercentUnhealthyPartitionsPerService": null, + "maxPercentUnhealthyReplicasPerPartition": null, + "maxPercentUnhealthyServices": null + }, + "maxPercentUnhealthyDeployedApplications": null //, + //"serviceTypeHealthPolicyMap": {} }, - "maxPercentUnhealthyDeployedApplications": "", - "serviceTypeHealthPolicyMap": {} - }, - "forceRestart": "", - "recreateApplication": "", - "rollingUpgradeMonitoringPolicy": { - "failureAction": "", - "healthCheckRetryTimeout": "", - "healthCheckStableDuration": "", - "healthCheckWaitDuration": "", - "upgradeDomainTimeout": "", - "upgradeTimeout": "" - }, - "upgradeMode": "", - "upgradeReplicaSetCheckTimeout": "" + "forceRestart": "", + "recreateApplication": "", + "rollingUpgradeMonitoringPolicy": { + "failureAction": null, + "healthCheckRetryTimeout": null, + "healthCheckStableDuration": null, + "healthCheckWaitDuration": null, + "upgradeDomainTimeout": null, + "upgradeTimeout": null + }, + "upgradeMode": "UnmonitoredAuto", + "upgradeReplicaSetCheckTimeout": null + } + }, + "applicationsServices": { + "value": [{ + "name": "Service01", + "properties": { + "provisioningState": "Default", + "correlationScheme": [{ + "scheme": "Invalid", + "serviceName": "fabric:service01" + }] + } + }] } }] }, "serviceFabricApplicationTypes": { - "value": { - "name": "", - "properties": {} - } - }, - "serviceFabricApplicationTypesVersions": { "value": [{ - "name": "", + "name": "DotNetCore", "properties": { - "appPackageUrl": "" - } - }] - }, - "serviceFabricApplicationsServices": { - "value": [{ - "name": "", - "properties": "" + "provisioningState": "Default" + }, + "applicationTypesVersions": [{ + "name": "VersionOne", + "properties": { + "provisioningState": "Default", + "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/blob/master/WordCountV1.sfpkg" + } + }] }] } } From a6e0682c13fcb0975f8c97e964b1cb35ea1badc6 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Tue, 26 Oct 2021 23:55:07 +0530 Subject: [PATCH 12/50] Update managementEndpoint param in line with cluster name. --- arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json index 7e372707bb..e9caf7217d 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -85,7 +85,7 @@ // }] // }, "managementEndpoint": { - "value": "https://sxx-az-sfc-weu-x-050.eastus.cloudapp.azure.com:19080" // Mandatory + "value": "https://sxx-az-sfc-weu-x-001.eastus.cloudapp.azure.com:19080" // Mandatory }, "nodeTypes": { // The list of node types in the cluster. "value": [{ From 1acfcc99523ab9a0d6ac41cfa61439625917ff1b Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 3 Nov 2021 15:53:34 +0530 Subject: [PATCH 13/50] Update to latest codebase from the source org's backup branch. --- .../.bicep/nested_applicationTypes.bicep | 14 +- .../clusters/.bicep/nested_applications.bicep | 4 +- .../clusters/deploy.bicep | 192 +++++++++--------- .../clusters/parameters/parameters.json | 177 ++++++++-------- .../clusters/readme.md | 102 ++++++++++ 5 files changed, 304 insertions(+), 185 deletions(-) create mode 100644 arm/Microsoft.ServiceFabric/clusters/readme.md diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep index 53d90ea004..e54c5f98ff 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep @@ -1,22 +1,22 @@ -param applicationType object +param applicationTypeObj object param clusterName string param location string param tags object param properties object -resource applicationTypes 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = { - name: '${clusterName}/applicationTypes-${applicationType.name}' +resource applicationType 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = { + name: '${clusterName}/applicationTypes-${applicationTypeObj.name}' location: location tags: tags properties: properties - resource versions 'versions@2021-06-01' = [for version in applicationType.applicationTypesVersions: { - name: version.name + resource versions 'versions@2021-06-01' = [for applicationTypesVersion in applicationTypeObj.applicationTypesVersions: { + name: applicationTypesVersion.name location: location tags: tags - properties: (!empty(version.properties) ? version.properties : json('null')) + properties: !empty(applicationTypesVersion.properties) ? applicationTypesVersion.properties : null }] } // Output -output serviceFabricClusterApplcationTypesId string = applicationTypes.id +output applicationTypeResourceId string = applicationType.id diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep index 1e1c8d9277..a8da09b30c 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep @@ -16,9 +16,9 @@ resource application 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' name: service.name location: location tags: tags - properties: (!empty(service.properties) ? service.properties : json('null')) + properties: !empty(service.properties) ? service.properties : null }] } // Output -output serviceFabricClusterApplicationsServicesResourceId string = application.id +output applicationResourceId string = application.id diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index c5713e8375..e3201fd184 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -47,7 +47,7 @@ param clientCertificateCommonNames array = [] param clientCertificateThumbprints array = [] @description('Optional. The Service Fabric runtime version of the cluster. This property can only by set the user when upgradeMode is set to "Manual". To get list of available Service Fabric versions for new clusters use ClusterVersion API. To get the list of available version for existing clusters use availableClusterVersions.') -param clusterCodeVersion string +param clusterCodeVersion string = '' @description('Optional. The storage account information for storing Service Fabric diagnostic logs.') param diagnosticsStorageAccountConfig object = {} @@ -141,15 +141,15 @@ param serviceFabricApplicationTypes array = [] // Var section var azureActiveDirectory_var = { - clientApplication: (!empty(azureActiveDirectory) ? azureActiveDirectory.clientApplication : json('null')) - clusterApplication: (!empty(azureActiveDirectory) ? azureActiveDirectory.clusterApplication : json('null')) - tenantId: (!empty(azureActiveDirectory) ? azureActiveDirectory.tenantId : json('null')) + clientApplication: !empty(azureActiveDirectory) ? azureActiveDirectory.clientApplication : null + clusterApplication: !empty(azureActiveDirectory) ? azureActiveDirectory.clusterApplication : null + tenantId: !empty(azureActiveDirectory) ? azureActiveDirectory.tenantId : null } var certificate_var = { - thumbprint: (!empty(certificate) ? certificate.thumbprint : json('null')) - thumbprintSecondary: (!empty(certificate) ? certificate.thumbprintSecondary : json('null')) - x509StoreName: (!empty(certificate) ? certificate.x509StoreName : json('null')) + thumbprint: !empty(certificate) ? certificate.thumbprint : null + thumbprintSecondary: !empty(certificate) ? certificate.thumbprintSecondary : null + x509StoreName: !empty(certificate) ? certificate.x509StoreName : null } var certificateCommonNamesList_var = [for index in range(0, (!empty(certificateCommonNames) ? length(certificateCommonNames.commonNames) : 0)): { @@ -157,68 +157,68 @@ var certificateCommonNamesList_var = [for index in range(0, (!empty(certificateC }] var certificateCommonNames_var = { - commonNames: (!empty(certificateCommonNames) ? certificateCommonNamesList_var : json('null')) - x509StoreName: (!empty(certificateCommonNames) ? certificateCommonNames.x509StoreName : json('null')) + commonNames: !empty(certificateCommonNames) ? certificateCommonNamesList_var : null + x509StoreName: !empty(certificateCommonNames) ? certificateCommonNames.x509StoreName : null } var clientCertificateCommonNames_var = [for index in range(0, (!empty(clientCertificateCommonNames) ? length(clientCertificateCommonNames) : 0)): { - certificateCommonName: (!empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateCommonName}' : json('null')) - certificateIssuerThumbprint: (!empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateIssuerThumbprint}' : json('null')) - isAdmin: (!empty(clientCertificateCommonNames) ? clientCertificateCommonNames[index].isAdmin : null) + certificateCommonName: !empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateCommonName}' : null + certificateIssuerThumbprint: !empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateIssuerThumbprint}' : null + isAdmin: !empty(clientCertificateCommonNames) ? clientCertificateCommonNames[index].isAdmin : null }] var clientCertificateThumbprints_var = [for index in range(0, (!empty(clientCertificateThumbprints) ? length(clientCertificateThumbprints) : 0)): { - certificateThumbprint: (!empty(clientCertificateThumbprints) ? '${clientCertificateThumbprints[index].certificateThumbprint}' : json('null')) - isAdmin: (!empty(clientCertificateThumbprints) ? clientCertificateThumbprints[index].isAdmin : null) + certificateThumbprint: !empty(clientCertificateThumbprints) ? '${clientCertificateThumbprints[index].certificateThumbprint}' : null + isAdmin: !empty(clientCertificateThumbprints) ? clientCertificateThumbprints[index].isAdmin : null }] var diagnosticsStorageAccountConfig_var = { - blobEndpoint: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.blobEndpoint : json('null')) - protectedAccountKeyName: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.protectedAccountKeyName : json('null')) - protectedAccountKeyName2: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.protectedAccountKeyName2 : json('null')) - queueEndpoint: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.queueEndpoint : json('null')) - storageAccountName: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.storageAccountName : json('null')) - tableEndpoint: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.tableEndpoint : json('null')) + blobEndpoint: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.blobEndpoint : null + protectedAccountKeyName: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.protectedAccountKeyName : null + protectedAccountKeyName2: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.protectedAccountKeyName2 : null + queueEndpoint: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.queueEndpoint : null + storageAccountName: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.storageAccountName : null + tableEndpoint: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.tableEndpoint : null } var fabricSettings_var = [for index in range(0, (!empty(fabricSettings) ? length(fabricSettings) : 0)): { - name: (!empty(fabricSettings) ? fabricSettings[index].name : json('null')) - parameters: (!empty(fabricSettings) ? fabricSettings[index].parameters : json('null')) + name: !empty(fabricSettings) ? fabricSettings[index].name : null + parameters: !empty(fabricSettings) ? fabricSettings[index].parameters : null }] var nodeTypes_var = [for nodeType in nodeTypes: { applicationPorts: contains(nodeType, 'applicationPorts') ? { - endPort: (contains(nodeType.applicationPorts, 'endPort') ? nodeType.applicationPorts.endPort : null) - startPort: (contains(nodeType.applicationPorts, 'startPort') ? nodeType.applicationPorts.startPort : null) - } : json('null') - capacities: (contains(nodeType, 'capacities') ? nodeType.capacities : json('null')) - clientConnectionEndpointPort: (contains(nodeType, 'clientConnectionEndpointPort') ? nodeType.clientConnectionEndpointPort : null) - durabilityLevel: (contains(nodeType, 'durabilityLevel') ? nodeType.durabilityLevel : null) + endPort: contains(nodeType.applicationPorts, 'endPort') ? nodeType.applicationPorts.endPort : null + startPort: contains(nodeType.applicationPorts, 'startPort') ? nodeType.applicationPorts.startPort : null + } : null + capacities: contains(nodeType, 'capacities') ? nodeType.capacities : null + clientConnectionEndpointPort: contains(nodeType, 'clientConnectionEndpointPort') ? nodeType.clientConnectionEndpointPort : null + durabilityLevel: contains(nodeType, 'durabilityLevel') ? nodeType.durabilityLevel : null ephemeralPorts: contains(nodeType, 'ephemeralPorts') ? { - endPort: (contains(nodeType.ephemeralPorts, 'endPort') ? nodeType.ephemeralPorts.endPort : null) - startPort: (contains(nodeType.ephemeralPorts, 'startPort') ? nodeType.ephemeralPorts.startPort : null) - } : json('null') - httpGatewayEndpointPort: (contains(nodeType, 'httpGatewayEndpointPort') ? nodeType.httpGatewayEndpointPort : null) - isPrimary: (contains(nodeType, 'isPrimary') ? nodeType.isPrimary : null) - isStateless: (contains(nodeType, 'isStateless') ? nodeType.isStateless : null) - multipleAvailabilityZones: (contains(nodeType, 'multipleAvailabilityZones') ? nodeType.multipleAvailabilityZones : null) + endPort: contains(nodeType.ephemeralPorts, 'endPort') ? nodeType.ephemeralPorts.endPort : null + startPort: contains(nodeType.ephemeralPorts, 'startPort') ? nodeType.ephemeralPorts.startPort : null + } : null + httpGatewayEndpointPort: contains(nodeType, 'httpGatewayEndpointPort') ? nodeType.httpGatewayEndpointPort : null + isPrimary: contains(nodeType, 'isPrimary') ? nodeType.isPrimary : null + isStateless: contains(nodeType, 'isStateless') ? nodeType.isStateless : null + multipleAvailabilityZones: contains(nodeType, 'multipleAvailabilityZones') ? nodeType.multipleAvailabilityZones : null name: '${(!empty(nodeType.name) ? nodeType.name : 'Node00')}' - placementProperties: (contains(nodeType, 'placementProperties') ? nodeType.placementProperties : json('null')) - reverseProxyEndpointPort: (contains(nodeType, 'reverseProxyEndpointPort') ? nodeType.reverseProxyEndpointPort : null) - vmInstanceCount: (contains(nodeType, 'vmInstanceCount') ? nodeType.vmInstanceCount : 1) + placementProperties: contains(nodeType, 'placementProperties') ? nodeType.placementProperties : null + reverseProxyEndpointPort: contains(nodeType, 'reverseProxyEndpointPort') ? nodeType.reverseProxyEndpointPort : null + vmInstanceCount: contains(nodeType, 'vmInstanceCount') ? nodeType.vmInstanceCount : 1 }] var notifications_var = [for index in range(0, (!empty(notifications) ? length(notifications) : 0)): { - isEnabled: (!empty(notifications) ? notifications[index].isEnabled : null) - notificationCategory: (!empty(notifications) ? notifications[index].notificationCategory : json('null')) - notificationLevel: (!empty(notifications) ? notifications[index].notificationLevel : null) - notificationTargets: (!empty(notifications) ? notifications[index].notificationTargets : json('null')) + isEnabled: !empty(notifications) ? notifications[index].isEnabled : null + notificationCategory: !empty(notifications) ? notifications[index].notificationCategory : null + notificationLevel: !empty(notifications) ? notifications[index].notificationLevel : null + notificationTargets: !empty(notifications) ? notifications[index].notificationTargets : null }] var reverseProxyCertificate_var = { - thumbprint: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprint : json('null')) - thumbprintSecondary: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprintSecondary : json('null')) - x509StoreName: (!empty(reverseProxyCertificate) ? reverseProxyCertificate.x509StoreName : null) + thumbprint: !empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprint : null + thumbprintSecondary: !empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprintSecondary : null + x509StoreName: !empty(reverseProxyCertificate) ? reverseProxyCertificate.x509StoreName : null } var reverseProxyCertificateCommonNamesList_var = [for index in range(0, (!empty(reverseProxyCertificateCommonNames) ? length(reverseProxyCertificateCommonNames.commonNames) : 0)): { @@ -226,28 +226,28 @@ var reverseProxyCertificateCommonNamesList_var = [for index in range(0, (!empty( }] var reverseProxyCertificateCommonNames_var = { - commonNames: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNamesList_var : json('null')) - x509StoreName: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames.x509StoreName : null) + commonNames: !empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNamesList_var : null + x509StoreName: !empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames.x509StoreName : null } var upgradeDescription_var = { deltaHealthPolicy: { - applicationDeltaHealthPolicies: (!empty(upgradeDescription) ? upgradeDescription.applicationDeltaHealthPolicies : json('null')) - maxPercentDeltaUnhealthyApplications: (!empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyApplications : null) - maxPercentDeltaUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyNodes : null) - maxPercentUpgradeDomainDeltaUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.maxPercentUpgradeDomainDeltaUnhealthyNodes : null) + applicationDeltaHealthPolicies: !empty(upgradeDescription) ? upgradeDescription.applicationDeltaHealthPolicies : null + maxPercentDeltaUnhealthyApplications: !empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyApplications : null + maxPercentDeltaUnhealthyNodes: !empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyNodes : null + maxPercentUpgradeDomainDeltaUnhealthyNodes: !empty(upgradeDescription) ? upgradeDescription.maxPercentUpgradeDomainDeltaUnhealthyNodes : null } - forceRestart: '${(!empty(upgradeDescription) ? upgradeDescription.forceRestart : json('null'))}' - healthCheckRetryTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckRetryTimeout : null)}' - healthCheckStableDuration: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckStableDuration : null)}' - healthCheckWaitDuration: '${(!empty(upgradeDescription) ? upgradeDescription.healthCheckWaitDuration : null)}' + forceRestart: '${!empty(upgradeDescription) ? upgradeDescription.forceRestart : null}' + healthCheckRetryTimeout: '${!empty(upgradeDescription) ? upgradeDescription.healthCheckRetryTimeout : null}' + healthCheckStableDuration: '${!empty(upgradeDescription) ? upgradeDescription.healthCheckStableDuration : null}' + healthCheckWaitDuration: '${!empty(upgradeDescription) ? upgradeDescription.healthCheckWaitDuration : null}' healthPolicy: { - applicationHealthPolicies: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.applicationHealthPolicies : json('null')) - maxPercentUnhealthyApplications: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : null) - maxPercentUnhealthyNodes: (!empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : null) - upgradeDomainTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeDomainTimeout : null)}' - upgradeReplicaSetCheckTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeReplicaSetCheckTimeout : null)}' - upgradeTimeout: '${(!empty(upgradeDescription) ? upgradeDescription.upgradeTimeout : null)}' + applicationHealthPolicies: !empty(upgradeDescription) ? upgradeDescription.healthPolicy.applicationHealthPolicies : null + maxPercentUnhealthyApplications: !empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : null + maxPercentUnhealthyNodes: !empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : null + upgradeDomainTimeout: '${!empty(upgradeDescription) ? upgradeDescription.upgradeDomainTimeout : null}' + upgradeReplicaSetCheckTimeout: '${!empty(upgradeDescription) ? upgradeDescription.upgradeReplicaSetCheckTimeout : null}' + upgradeTimeout: '${!empty(upgradeDescription) ? upgradeDescription.upgradeTimeout : null}' } } @@ -282,30 +282,30 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { applicationTypeVersionsCleanupPolicy: { maxUnusedVersionsToKeep: maxUnusedVersionsToKeep } - azureActiveDirectory: (!empty(azureActiveDirectory) ? azureActiveDirectory_var : json('null')) - certificate: (!empty(certificate) ? certificate_var : json('null')) - certificateCommonNames: (!empty(certificateCommonNames) ? certificateCommonNames_var : json('null')) - clientCertificateCommonNames: (!empty(clientCertificateCommonNames) ? clientCertificateCommonNames_var : json('null')) - clientCertificateThumbprints: (!empty(clientCertificateThumbprints) ? clientCertificateThumbprints_var : json('null')) - clusterCodeVersion: '${(!empty(clusterCodeVersion) ? clusterCodeVersion : null)}' - diagnosticsStorageAccountConfig: (!empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig_var : json('null')) + azureActiveDirectory: !empty(azureActiveDirectory) ? azureActiveDirectory_var : null + certificate: !empty(certificate) ? certificate_var : null + certificateCommonNames: !empty(certificateCommonNames) ? certificateCommonNames_var : null + clientCertificateCommonNames: !empty(clientCertificateCommonNames) ? clientCertificateCommonNames_var : null + clientCertificateThumbprints: !empty(clientCertificateThumbprints) ? clientCertificateThumbprints_var : null + clusterCodeVersion: !empty(clusterCodeVersion) ? clusterCodeVersion : null + diagnosticsStorageAccountConfig: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig_var : null eventStoreServiceEnabled: eventStoreServiceEnabled - fabricSettings: (!empty(fabricSettings) ? fabricSettings_var : json('null')) + fabricSettings: !empty(fabricSettings) ? fabricSettings_var : null infrastructureServiceManager: infrastructureServiceManager - managementEndpoint: '${(!empty(managementEndpoint) ? managementEndpoint : null)}' + managementEndpoint: '${!empty(managementEndpoint) ? managementEndpoint : null}' nodeTypes: nodeTypes_var - notifications: (!empty(notifications) ? notifications_var : json('null')) + notifications: !empty(notifications) ? notifications_var : null reliabilityLevel: reliabilityLevel - reverseProxyCertificate: (!empty(reverseProxyCertificate) ? reverseProxyCertificate_var : json('null')) - reverseProxyCertificateCommonNames: (!empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames_var : json('null')) - sfZonalUpgradeMode: (!empty(sfZonalUpgradeMode) ? sfZonalUpgradeMode : json('null')) - upgradeDescription: (!empty(upgradeDescription) ? upgradeDescription_var : json('null')) - upgradeMode: (!empty(upgradeMode) ? upgradeMode : null) - upgradePauseEndTimestampUtc: (!empty(upgradePauseEndTimestampUtc) ? upgradePauseEndTimestampUtc : null) - upgradePauseStartTimestampUtc: (!empty(upgradePauseStartTimestampUtc) ? upgradePauseStartTimestampUtc : null) - upgradeWave: (!empty(upgradeWave) ? upgradeWave : null) - vmImage: (!empty(vmImage) ? vmImage : null) - vmssZonalUpgradeMode: (!empty(vmssZonalUpgradeMode) ? vmssZonalUpgradeMode : null) + reverseProxyCertificate: !empty(reverseProxyCertificate) ? reverseProxyCertificate_var : null + reverseProxyCertificateCommonNames: !empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames_var : null + sfZonalUpgradeMode: !empty(sfZonalUpgradeMode) ? sfZonalUpgradeMode : null + upgradeDescription: !empty(upgradeDescription) ? upgradeDescription_var : null + upgradeMode: !empty(upgradeMode) ? upgradeMode : null + upgradePauseEndTimestampUtc: !empty(upgradePauseEndTimestampUtc) ? upgradePauseEndTimestampUtc : null + upgradePauseStartTimestampUtc: !empty(upgradePauseStartTimestampUtc) ? upgradePauseStartTimestampUtc : null + upgradeWave: !empty(upgradeWave) ? upgradeWave : null + vmImage: !empty(vmImage) ? vmImage : null + vmssZonalUpgradeMode: !empty(vmssZonalUpgradeMode) ? vmssZonalUpgradeMode : null waveUpgradePaused: waveUpgradePaused } } @@ -321,7 +321,7 @@ resource serviceFabricCluster_lock 'Microsoft.Authorization/locks@2016-09-01' = } // Service Fabric cluster RBAC assignment -module serviceFabricCluster_rbac './.bicep/nested_rbac.bicep' = [for (roleAssignment, index) in roleAssignments: { +module serviceFabricCluster_rbac '.bicep/nested_rbac.bicep' = [for (roleAssignment, index) in roleAssignments: { name: '${serviceFabricCluster.name}-${uniqueString(deployment().name, location)}-Rbac-${index}' params: { roleAssignmentObj: roleAssignment @@ -334,11 +334,11 @@ module serviceFabricCluster_rbac './.bicep/nested_rbac.bicep' = [for (roleAssign module serviceFabricCluster_applicationTypes '.bicep/nested_applicationTypes.bicep' = [for applicationType in serviceFabricApplicationTypes: { name: '${serviceFabricCluster.name}-${applicationType.name}' params: { - applicationType: applicationType + applicationTypeObj: applicationType clusterName: serviceFabricCluster.name location: location tags: tags - properties: (!empty(applicationType.properties) ? applicationType.properties : json('null')) + properties: !empty(applicationType.properties) ? applicationType.properties : null } }] @@ -350,17 +350,17 @@ module serviceFabricCluster_applications '.bicep/nested_applications.bicep' = [f clusterName: serviceFabricCluster.name location: location tags: tags - identity: (!empty(application.identity) ? application.identity : json('null')) + identity: !empty(application.identity) ? application.identity : null properties: { - managedIdentities: (!empty(application.managedIdentities) ? application.managedIdentities : json('null')) - maximumNodes: (contains(application, 'maximumNodes') ? application.maximumNodes : 1) - metrics: (!empty(application.metrics) ? application.metrics : json('null')) - minimumNodes: (contains(application, 'minimumNodes') ? application.minimumNodes : 0) - parameters: (!empty(application.parameters) ? application.parameters : json('null')) - removeApplicationCapacity: (contains(application, 'removeApplicationCapacity') ? application.removeApplicationCapacity : false) - typeName: (!empty(application.typeName) ? application.typeName : null) - typeVersion: (!empty(application.typeVersion) ? application.typeVersion : null) - upgradePolicy: (!empty(application.upgradePolicy) ? application.upgradePolicy : json('null')) + managedIdentities: !empty(application.managedIdentities) ? application.managedIdentities : null + maximumNodes: contains(application, 'maximumNodes') ? application.maximumNodes : 1 + metrics: !empty(application.metrics) ? application.metrics : null + minimumNodes: contains(application, 'minimumNodes') ? application.minimumNodes : 0 + parameters: !empty(application.parameters) ? application.parameters : null + removeApplicationCapacity: contains(application, 'removeApplicationCapacity') ? application.removeApplicationCapacity : false + typeName: !empty(application.typeName) ? application.typeName : null + typeVersion: !empty(application.typeVersion) ? application.typeVersion : null + upgradePolicy: !empty(application.upgradePolicy) ? application.upgradePolicy : null } } dependsOn: [ @@ -370,5 +370,5 @@ module serviceFabricCluster_applications '.bicep/nested_applications.bicep' = [f // Outputs section output serviceFabricClusterName string = serviceFabricCluster.name -output serviceFabricClusterId string = serviceFabricCluster.id -output serviceFabricClusterProperties object = serviceFabricCluster.properties +output serviceFabricClusterResourceId string = serviceFabricCluster.id +output serviceFabricClusterResourceGroup string = resourceGroup().name diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json index e9caf7217d..33cc693034 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -62,9 +62,9 @@ // "isAdmin": "" // If 'clientCertificateThumbprints' is passed then this is mandatory // }] // }, - "clusterCodeVersion": { - "value": "8.1.329.9590" - }, + // "clusterCodeVersion": { + // "value": "8.1.329.9590" + // }, // "diagnosticsStorageAccountConfig": { // "value": { // "blobEndpoint": "", // If 'diagnosticsStorageAccountConfig' is passed then this is mandatory @@ -88,7 +88,8 @@ "value": "https://sxx-az-sfc-weu-x-001.eastus.cloudapp.azure.com:19080" // Mandatory }, "nodeTypes": { // The list of node types in the cluster. - "value": [{ + "value": [ + { "applicationPorts": { "endPort": 30000, "startPort": 20000 @@ -150,90 +151,106 @@ "value": "WindowsServer 2016-Datacenter" }, "roleAssignments": { - "value": [{ - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "5545f7a0-51f4-46af-b3b4-baecf5176a56" - ] - }] + "value": [ + { + "roleDefinitionIdOrName": "Reader", + "principalIds": [ + "5545f7a0-51f4-46af-b3b4-baecf5176a56" + ] + } + ] }, "serviceFabricClusterApplications": { - "value": [{ - "name": "serviceFabricClusterApplication01", - "identity": { - "type": "None", - "userAssignedIdentities": {} - }, - "properties": { - "managedIdentities": [{ - "name": "Identity_Friendly_Name", - "principalId": "5545f7a0-51f4-46af-b3b4-baecf5176a56" - }], - "maximumNodes": 2, - "metrics": [{ - "maximumCapacity": null, - "name": null, - "reservationCapacity": null, - "totalApplicationCapacity": null - }], - "minimumNodes": null, - "parameters": {}, - "removeApplicationCapacity": "", - "typeName": "DotNetCore", - "typeVersion": "VersionOne", - "upgradePolicy": { - "applicationHealthPolicy": { - "considerWarningAsError": "", - "defaultServiceTypeHealthPolicy": { - "maxPercentUnhealthyPartitionsPerService": null, - "maxPercentUnhealthyReplicasPerPartition": null, - "maxPercentUnhealthyServices": null + "value": [ + { + "name": "serviceFabricClusterApplication01", + "identity": { + "type": "None", + "userAssignedIdentities": {} + }, + "properties": { + "managedIdentities": [ + { + "name": "Identity_Friendly_Name", + "principalId": "5545f7a0-51f4-46af-b3b4-baecf5176a56" + } + ], + "maximumNodes": 2, + "metrics": [ + { + "maximumCapacity": null, + "name": null, + "reservationCapacity": null, + "totalApplicationCapacity": null + } + ], + "minimumNodes": null, + "parameters": {}, + "removeApplicationCapacity": "", + "typeName": "DotNetCore", + "typeVersion": "VersionOne", + "upgradePolicy": { + "applicationHealthPolicy": { + "considerWarningAsError": "", + "defaultServiceTypeHealthPolicy": { + "maxPercentUnhealthyPartitionsPerService": null, + "maxPercentUnhealthyReplicasPerPartition": null, + "maxPercentUnhealthyServices": null + }, + "maxPercentUnhealthyDeployedApplications": null //, + //"serviceTypeHealthPolicyMap": {} }, - "maxPercentUnhealthyDeployedApplications": null //, - //"serviceTypeHealthPolicyMap": {} - }, - "forceRestart": "", - "recreateApplication": "", - "rollingUpgradeMonitoringPolicy": { - "failureAction": null, - "healthCheckRetryTimeout": null, - "healthCheckStableDuration": null, - "healthCheckWaitDuration": null, - "upgradeDomainTimeout": null, - "upgradeTimeout": null - }, - "upgradeMode": "UnmonitoredAuto", - "upgradeReplicaSetCheckTimeout": null - } - }, - "applicationsServices": { - "value": [{ - "name": "Service01", - "properties": { - "provisioningState": "Default", - "correlationScheme": [{ - "scheme": "Invalid", - "serviceName": "fabric:service01" - }] + "forceRestart": "", + "recreateApplication": "", + "rollingUpgradeMonitoringPolicy": { + "failureAction": null, + "healthCheckRetryTimeout": null, + "healthCheckStableDuration": null, + "healthCheckWaitDuration": null, + "upgradeDomainTimeout": null, + "upgradeTimeout": null + }, + "upgradeMode": "UnmonitoredAuto", + "upgradeReplicaSetCheckTimeout": null } - }] + }, + "applicationsServices": { + "value": [ + { + "name": "Service01", + "properties": { + "provisioningState": "Default", + "correlationScheme": [ + { + "scheme": "Invalid", + "serviceName": "fabric:service01" + } + ] + } + } + ] + } } - }] + ] }, "serviceFabricApplicationTypes": { - "value": [{ - "name": "DotNetCore", - "properties": { - "provisioningState": "Default" - }, - "applicationTypesVersions": [{ - "name": "VersionOne", + "value": [ + { + "name": "DotNetCore", "properties": { - "provisioningState": "Default", - "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/blob/master/WordCountV1.sfpkg" - } - }] - }] + "provisioningState": "Default" + }, + "applicationTypesVersions": [ + { + "name": "VersionOne", + "properties": { + "provisioningState": "Default", + "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/blob/master/WordCountV1.sfpkg" + } + } + ] + } + ] } } } diff --git a/arm/Microsoft.ServiceFabric/clusters/readme.md b/arm/Microsoft.ServiceFabric/clusters/readme.md new file mode 100644 index 0000000000..c1b34dc305 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/readme.md @@ -0,0 +1,102 @@ +# ServiceFabric Clusters `[Microsoft.ServiceFabric/clusters]` + +This module deploys a service fabric cluster + +## Resource Types + +| Resource Type | Api Version | +| :-- | :-- | +| `Microsoft.Authorization/locks` | 2016-09-01 | +| `Microsoft.ServiceFabric/clusters` | 2021-06-01 | +| `Microsoft.ServiceFabric/clusters/applications` | 2021-06-01 | +| `Microsoft.ServiceFabric/clusters/applications/services` | 2021-06-01 | +| `Microsoft.ServiceFabric/clusters/applicationTypes` | 2021-06-01 | +| `Microsoft.ServiceFabric/clusters/applicationTypes/versions` | 2021-06-01 | +| `Microsoft.ServiceFabric/clusters/providers/roleAssignments` | 2020-04-01-preview | + +## Parameters + +| Parameter Name | Type | Default Value | Possible Values | Description | +| :-- | :-- | :-- | :-- | :-- | +| `addOnFeatures` | array | `[]` | `[BackupRestoreService, DnsService, RepairManager, ResourceMonitorService]` | Optional. The list of add-on features to enable in the cluster. | +| `azureActiveDirectory` | object | `{object}` | | Optional. Object containing Azure active directory client application id, cluster application id and tenant id. | +| `certificate` | object | `{object}` | | Optional. Describes the certificate details like thumbprint of the primary certificate, thumbprint of the secondary certificate and the local certificate store location | +| `certificateCommonNames` | object | `{object}` | | Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster. | +| `clientCertificateCommonNames` | array | `[]` | | Optional. The list of client certificates referenced by common name that are allowed to manage the cluster. | +| `clientCertificateThumbprints` | array | `[]` | | Optional. The list of client certificates referenced by thumbprint that are allowed to manage the cluster. | +| `clusterCodeVersion` | string | | | Optional. The Service Fabric runtime version of the cluster. This property can only by set the user when upgradeMode is set to "Manual". To get list of available Service Fabric versions for new clusters use ClusterVersion API. To get the list of available version for existing clusters use availableClusterVersions. | +| `cuaId` | string | | | Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered | +| `diagnosticsStorageAccountConfig` | object | `{object}` | | Optional. The storage account information for storing Service Fabric diagnostic logs. | +| `eventStoreServiceEnabled` | bool | | | Optional. Indicates if the event store service is enabled. | +| `fabricSettings` | array | `[]` | | Optional. The list of custom fabric settings to configure the cluster. | +| `infrastructureServiceManager` | bool | | | Optional. Indicates if infrastructure service manager is enabled. | +| `location` | string | `[resourceGroup().location]` | | Optional. Location for all resources. | +| `lock` | string | `NotSpecified` | `[CanNotDelete, NotSpecified, ReadOnly]` | Optional. Specify the type of lock. | +| `managementEndpoint` | string | | | Required. The http management endpoint of the cluster. | +| `maxUnusedVersionsToKeep` | int | `3` | | Required. Number of unused versions per application type to keep. | +| `nodeTypes` | array | `[]` | | Required. The list of node types in the cluster. | +| `notifications` | array | `[]` | | Optional. Indicates a list of notification channels for cluster events. | +| `reliabilityLevel` | string | `None` | `[Bronze, Gold, None, Platinum, Silver]` | Optional. The reliability level sets the replica set size of system services. Learn about ReliabilityLevel (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-capacity). - None - Run the System services with a target replica set count of 1. This should only be used for test clusters. - Bronze - Run the System services with a target replica set count of 3. This should only be used for test clusters. - Silver - Run the System services with a target replica set count of 5. - Gold - Run the System services with a target replica set count of 7. - Platinum - Run the System services with a target replica set count of 9. | +| `reverseProxyCertificate` | object | `{object}` | | Optional. Describes the certificate details. | +| `reverseProxyCertificateCommonNames` | object | `{object}` | | Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster. | +| `roleAssignments` | array | `[]` | | Optional. Array of role assignment objects that contain the 'roleDefinitionIdOrName' and 'principalId' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or it's fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11' | +| `serviceFabricApplicationTypes` | array | `[]` | | Optional. Array of Service Fabric cluster application types. | +| `serviceFabricClusterApplications` | array | `[]` | | Optional. Array of Service Fabric cluster applications. | +| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | +| `sfZonalUpgradeMode` | string | `Hierarchical` | `[Hierarchical, Parallel]` | Optional. This property controls the logical grouping of VMs in upgrade domains (UDs). This property cannot be modified if a node type with multiple Availability Zones is already present in the cluster. | +| `tags` | object | `{object}` | | Optional. Tags of the resource. | +| `upgradeDescription` | object | `{object}` | | Optional. Describes the policy used when upgrading the cluster. | +| `upgradeMode` | string | `Automatic` | `[Automatic, Manual]` | Optional. The upgrade mode of the cluster when new Service Fabric runtime version is available. | +| `upgradePauseEndTimestampUtc` | string | | | Optional. Indicates the end date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). | +| `upgradePauseStartTimestampUtc` | string | | | Optional. Indicates the start date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). | +| `upgradeWave` | string | `Wave0` | `[Wave0, Wave1, Wave2]` | Optional. Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. | +| `vmImage` | string | | | Optional. The VM image VMSS has been configured with. Generic names such as Windows or Linux can be used | +| `vmssZonalUpgradeMode` | string | `Hierarchical` | `[Hierarchical, Parallel]` | Optional. This property defines the upgrade mode for the virtual machine scale set, it is mandatory if a node type with multiple Availability Zones is added. | +| `waveUpgradePaused` | bool | | | Optional. Boolean to pause automatic runtime version upgrades to the cluster. | + + +### Parameter Usage: `roleAssignments` + +```json +"roleAssignments": { + "value": [ + { + "roleDefinitionIdOrName": "Storage File Data SMB Share Contributor", + "principalIds": [ + "12345678-1234-1234-1234-123456789012", // object 1 + "78945612-1234-1234-1234-123456789012" // object 2 + ] + }, + { + "roleDefinitionIdOrName": "Reader", + "principalIds": [ + "12345678-1234-1234-1234-123456789012", // object 1 + "78945612-1234-1234-1234-123456789012" // object 2 + ] + }, + { + "roleDefinitionIdOrName": "/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11", + "principalIds": [ + "12345678-1234-1234-1234-123456789012" // object 1 + ] + } + ] +} +``` + +## Outputs + +| Output Name | Type | +| :-- | :-- | +| `serviceFabricClusterName` | string | +| `serviceFabricClusterResourceGroup` | string | +| `serviceFabricClusterResourceId` | string | + +## Template references + +- [Locks](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2016-09-01/locks) +- [Clusters](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters) +- [Clusters/Applications](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications) +- [Clusters/Applications/Services](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications/services) +- [Clusters/Applicationtypes](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes) +- [Clusters/Applicationtypes/Versions](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes/versions) From dd41e61865e8c8dde014bb1340c1bd4f255bfcc6 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 3 Nov 2021 19:23:51 +0530 Subject: [PATCH 14/50] Create nested module for service fabric prereqs and update deploy.bicep. --- .../.bicep/nested_prerequisites.bicep | 215 ++++++++++++++++++ .../clusters/deploy.bicep | 12 + 2 files changed, 227 insertions(+) create mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_prerequisites.bicep diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_prerequisites.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_prerequisites.bicep new file mode 100644 index 0000000000..99b26b4d04 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_prerequisites.bicep @@ -0,0 +1,215 @@ +param serviceFabricClusterName string +param location string +param tags object + +var vmNodeType0Name = 'nodevm' + +resource supportLogStorageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = { + kind: 'Storage' + location: location + name: 'suprtlogstrg01' + sku: { + name: 'Standard_LRS' + } + tags: tags +} + +resource applicationDiagnosticsStorageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = { + kind: 'Storage' + location: location + name: 'appdiagstrg01' + sku: { + name: 'Standard_LRS' + } + tags: tags +} + +resource virtualNetwork 'Microsoft.Network/virtualNetworks@2021-03-01' = { + location: location + name: 'vnet-01' + properties: { + addressSpace: { + addressPrefixes: [ + '10.0.0.0/16' + ] + } + subnets: [ + { + name: 'subnet-01' + properties: { + addressPrefix: '10.0.0.0/24' + } + } + ] + } + tags: tags +} + +resource loadBalancerPublicIPAddress 'Microsoft.Network/publicIPAddresses@2021-03-01' = { + name: 'ServiceFabricLBPIP' + location: location + properties: { + dnsSettings: { + domainNameLabel: serviceFabricClusterName + } + publicIPAllocationMethod: 'Dynamic' + } + tags: tags +} + +resource loadBalancer 'Microsoft.Network/loadBalancers@2021-03-01' = { + name: 'ServiceFabricLB' + location: location + properties: { + frontendIPConfigurations: [ + { + name: 'LoadBalancerIPConfig' + properties: { + publicIPAddress: { + id: loadBalancerPublicIPAddress.id + } + } + } + ] + backendAddressPools: [ + { + name: 'LoadBalancerBEAddressPool' + properties: {} + } + ] + loadBalancingRules: [ + { + name: 'LBRule' + properties: { + backendAddressPool: { + id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'LoadBalancerBEAddressPool') + } + backendPort: 19000 + enableFloatingIP: true + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'LoadBalancerIPConfig') + } + frontendPort: 19000 + idleTimeoutInMinutes: 5 + probe: { + id: resourceId('Microsoft.Network/loadBalancers/probes', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'FabricGatewayProbe') + } + protocol: 'Tcp' + } + } + { + name: 'LBHttpRule' + properties: { + backendAddressPool: { + id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'LoadBalancerBEAddressPool') + } + backendPort: 19080 + enableFloatingIP: false + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'LoadBalancerIPConfig') + } + frontendPort: 19080 + idleTimeoutInMinutes: 5 + probe: { + id: resourceId('Microsoft.Network/loadBalancers/probes', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'FabricHttpGatewayProbe') + } + protocol: 'Tcp' + } + } + { + name: 'AppPortLBRule1' + properties: { + backendAddressPool: { + id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'LoadBalancerBEAddressPool') + } + backendPort: 80 + enableFloatingIP: false + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'LoadBalancerIPConfig') + } + frontendPort: 80 + idleTimeoutInMinutes: 5 + probe: { + id: resourceId('Microsoft.Network/loadBalancers/probes', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'AppPortProbe1') + } + protocol: 'Tcp' + } + } + { + name: 'AppPortLBRule2' + properties: { + backendAddressPool: { + id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'LoadBalancerBEAddressPool') + } + backendPort: 8081 + enableFloatingIP: false + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'LoadBalancerIPConfig') + } + frontendPort: 8081 + idleTimeoutInMinutes: 5 + probe: { + id: resourceId('Microsoft.Network/loadBalancers/probes', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'AppPortProbe2') + } + protocol: 'Tcp' + } + } + ] + probes: [ + { + name: 'FabricGatewayProbe' + properties: { + port: 19000 + protocol: 'Tcp' + intervalInSeconds: 5 + numberOfProbes: 2 + } + } + { + name: 'FabricHttpGatewayProbe' + properties: { + port: 19080 + protocol: 'Tcp' + intervalInSeconds: 5 + numberOfProbes: 2 + } + } + { + name: 'AppPortProbe1' + properties: { + port: 80 + protocol: 'Tcp' + intervalInSeconds: 5 + numberOfProbes: 2 + } + } + { + name: 'AppPortProbe2' + properties: { + port: 8081 + protocol: 'Tcp' + intervalInSeconds: 5 + numberOfProbes: 2 + } + } + ] + inboundNatPools: [ + { + name: 'LoadBalancerBEAddressNatPool' + properties: { + backendPort: 22 + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', 'LB-${serviceFabricClusterName}-${vmNodeType0Name}', 'LoadBalancerIPConfig') + } + frontendPortRangeEnd: 4500 + frontendPortRangeStart: 3389 + protocol: 'Tcp' + } + } + ] + } + tags: tags + dependsOn: [ + loadBalancerPublicIPAddress + ] +} diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index e3201fd184..c89bd23243 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -272,6 +272,18 @@ module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { params: {} } +// Prereq resources for testing from +// https://github.com/Azure/azure-quickstart-templates/blob/master/quickstarts/microsoft.servicefabric/service-fabric-secure-cluster-5-node-1-nodetype/azuredeploy.json + +module serviceFabricPrerequisites '.bicep/nested_prerequisites.bicep' = { + name: '${serviceFabricCluster.name}-${uniqueString(deployment().name, location)}-Prereqs' + params: { + serviceFabricClusterName: serviceFabricClusterName + location: location + tags: tags + } +} + // Service Fabric cluster resource resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { name: serviceFabricClusterName From 9b6b824302cb2027507c281f547f41a0d71dd316 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Tue, 9 Nov 2021 12:05:08 +0530 Subject: [PATCH 15/50] Update bicep module with prerequisites and post provisioning resources. --- .../.bicep/nested_postrequisites.bicep | 358 ++++++++++++++++++ .../.bicep/nested_prerequisites.bicep | 215 ----------- .../clusters/deploy.bicep | 120 +++--- .../clusters/parameters/parameters.json | 118 +++--- 4 files changed, 474 insertions(+), 337 deletions(-) create mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_postrequisites.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_prerequisites.bicep diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_postrequisites.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_postrequisites.bicep new file mode 100644 index 0000000000..d5c6673dec --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_postrequisites.bicep @@ -0,0 +1,358 @@ +param serviceFabricClusterObj object +param supportLogStorageAccountKeys object +param location string +param tags object + +var serviceFabricClusterName = split(serviceFabricClusterObj.resourceId, '/')[2] +var vmNodeType0Name = serviceFabricClusterObj.properties.nodeTypes[0].name + +resource applicationDiagnosticsStorageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = { + kind: 'Storage' + location: location + name: 'appdiagstrg01' + sku: { + name: 'Standard_LRS' + } + tags: tags +} + +resource virtualNetwork 'Microsoft.Network/virtualNetworks@2021-03-01' = { + location: location + name: '${serviceFabricClusterName}-vnet-01' + properties: { + addressSpace: { + addressPrefixes: [ + '10.0.0.0/16' + ] + } + subnets: [ + { + name: 'subnet-01' + properties: { + addressPrefix: '10.0.0.0/24' + } + } + ] + } + tags: tags +} + +resource loadBalancerPublicIPAddress 'Microsoft.Network/publicIPAddresses@2021-03-01' = { + name: '${serviceFabricClusterName}-LB-PIP' + location: location + properties: { + dnsSettings: { + domainNameLabel: serviceFabricClusterName + } + publicIPAllocationMethod: 'Dynamic' + } + tags: tags +} + +resource loadBalancer 'Microsoft.Network/loadBalancers@2021-03-01' = { + name: '${serviceFabricClusterName}-LB' + location: location + properties: { + frontendIPConfigurations: [ + { + name: 'LoadBalancerIPConfig' + properties: { + publicIPAddress: { + id: loadBalancerPublicIPAddress.id + } + } + } + ] + backendAddressPools: [ + { + name: 'LoadBalancerBEAddressPool' + properties: {} + } + ] + loadBalancingRules: [ + { + name: 'LBRule' + properties: { + backendAddressPool: { + id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', '${serviceFabricClusterName}-LB', 'LoadBalancerBEAddressPool') + } + backendPort: 19000 + enableFloatingIP: true + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') + } + frontendPort: 19000 + idleTimeoutInMinutes: 5 + probe: { + id: resourceId('Microsoft.Network/loadBalancers/probes', '${serviceFabricClusterName}-LB', 'FabricGatewayProbe') + } + protocol: 'Tcp' + } + } + { + name: 'LBHttpRule' + properties: { + backendAddressPool: { + id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', '${serviceFabricClusterName}-LB', 'LoadBalancerBEAddressPool') + } + backendPort: 19080 + enableFloatingIP: false + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') + } + frontendPort: 19080 + idleTimeoutInMinutes: 5 + probe: { + id: resourceId('Microsoft.Network/loadBalancers/probes', '${serviceFabricClusterName}-LB', 'FabricHttpGatewayProbe') + } + protocol: 'Tcp' + } + } + { + name: 'AppPortLBRule1' + properties: { + backendAddressPool: { + id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', '${serviceFabricClusterName}-LB', 'LoadBalancerBEAddressPool') + } + backendPort: 80 + enableFloatingIP: false + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') + } + frontendPort: 80 + idleTimeoutInMinutes: 5 + probe: { + id: resourceId('Microsoft.Network/loadBalancers/probes', '${serviceFabricClusterName}-LB', 'AppPortProbe1') + } + protocol: 'Tcp' + } + } + { + name: 'AppPortLBRule2' + properties: { + backendAddressPool: { + id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', '${serviceFabricClusterName}-LB', 'LoadBalancerBEAddressPool') + } + backendPort: 8081 + enableFloatingIP: false + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') + } + frontendPort: 8081 + idleTimeoutInMinutes: 5 + probe: { + id: resourceId('Microsoft.Network/loadBalancers/probes', '${serviceFabricClusterName}-LB', 'AppPortProbe2') + } + protocol: 'Tcp' + } + } + ] + probes: [ + { + name: 'FabricGatewayProbe' + properties: { + port: 19000 + protocol: 'Tcp' + intervalInSeconds: 5 + numberOfProbes: 2 + } + } + { + name: 'FabricHttpGatewayProbe' + properties: { + port: 19080 + protocol: 'Tcp' + intervalInSeconds: 5 + numberOfProbes: 2 + } + } + { + name: 'AppPortProbe1' + properties: { + port: 80 + protocol: 'Tcp' + intervalInSeconds: 5 + numberOfProbes: 2 + } + } + { + name: 'AppPortProbe2' + properties: { + port: 8081 + protocol: 'Tcp' + intervalInSeconds: 5 + numberOfProbes: 2 + } + } + ] + inboundNatPools: [ + { + name: 'LoadBalancerBEAddressNatPool' + properties: { + backendPort: 22 + frontendIPConfiguration: { + id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') + } + frontendPortRangeEnd: 4500 + frontendPortRangeStart: 3389 + protocol: 'Tcp' + } + } + ] + } + tags: tags + dependsOn: [ + loadBalancerPublicIPAddress + ] +} + +var wadlogs = '' + +var wadperfcounters1 = '' + +var wadperfcounters2 = '' + +var wadcfgxstart = '${wadlogs}${wadperfcounters1}${wadperfcounters2} Date: Wed, 1 Dec 2021 16:44:10 +0530 Subject: [PATCH 16/50] Resolve PR comments. --- .vscode/settings.json | 2 +- .../.bicep/nested_applicationTypes.bicep | 22 -- .../clusters/.bicep/nested_applications.bicep | 24 -- .../.bicep/nested_postrequisites.bicep | 358 ------------------ .../clusters/.bicep/nested_rbac.bicep | 33 +- .../.bicep/nested_cuaId.bicep | 0 .../clusters/applicationTypes/deploy.bicep | 48 +++ .../versions/.bicep/nested_cuaId.bicep | 0 .../applicationTypes/versions/deploy.bicep | 43 +++ .../applications/.bicep/nested_cuaId.bicep | 0 .../clusters/applications/deploy.bicep | 94 +++++ .../services/.bicep/nested_cuaId.bicep | 0 .../applications/services/deploy.bicep | 38 ++ .../clusters/deploy.bicep | 138 +++---- .../clusters/parameters/parameters.json | 174 ++++----- 15 files changed, 382 insertions(+), 592 deletions(-) delete mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/.bicep/nested_postrequisites.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/applicationTypes/.bicep/nested_cuaId.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/.bicep/nested_cuaId.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/.bicep/nested_cuaId.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/services/.bicep/nested_cuaId.bicep create mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep diff --git a/.vscode/settings.json b/.vscode/settings.json index 8b56df2cb7..c63f4cb6f3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,7 +16,7 @@ "editor.tabSize": 2 }, "editor.formatOnPaste": true, - "editor.formatOnSave": true, + "editor.formatOnSave": false, "editor.insertSpaces": true, "files.insertFinalNewline": true, "files.trimTrailingWhitespace": true, diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep deleted file mode 100644 index e54c5f98ff..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applicationTypes.bicep +++ /dev/null @@ -1,22 +0,0 @@ -param applicationTypeObj object -param clusterName string -param location string -param tags object -param properties object - -resource applicationType 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = { - name: '${clusterName}/applicationTypes-${applicationTypeObj.name}' - location: location - tags: tags - properties: properties - - resource versions 'versions@2021-06-01' = [for applicationTypesVersion in applicationTypeObj.applicationTypesVersions: { - name: applicationTypesVersion.name - location: location - tags: tags - properties: !empty(applicationTypesVersion.properties) ? applicationTypesVersion.properties : null - }] -} - -// Output -output applicationTypeResourceId string = applicationType.id diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep deleted file mode 100644 index a8da09b30c..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_applications.bicep +++ /dev/null @@ -1,24 +0,0 @@ -param applicationObj object -param clusterName string -param location string -param tags object -param identity object -param properties object - -resource application 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = { - name: '${clusterName}/application-${applicationObj.name}' - location: location - tags: tags - identity: identity - properties: properties - - resource services 'services@2021-06-01' = [for service in applicationObj.applicationsServices: { - name: service.name - location: location - tags: tags - properties: !empty(service.properties) ? service.properties : null - }] -} - -// Output -output applicationResourceId string = application.id diff --git a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_postrequisites.bicep b/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_postrequisites.bicep deleted file mode 100644 index d5c6673dec..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/.bicep/nested_postrequisites.bicep +++ /dev/null @@ -1,358 +0,0 @@ -param serviceFabricClusterObj object -param supportLogStorageAccountKeys object -param location string -param tags object - -var serviceFabricClusterName = split(serviceFabricClusterObj.resourceId, '/')[2] -var vmNodeType0Name = serviceFabricClusterObj.properties.nodeTypes[0].name - -resource applicationDiagnosticsStorageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = { - kind: 'Storage' - location: location - name: 'appdiagstrg01' - sku: { - name: 'Standard_LRS' - } - tags: tags -} - -resource virtualNetwork 'Microsoft.Network/virtualNetworks@2021-03-01' = { - location: location - name: '${serviceFabricClusterName}-vnet-01' - properties: { - addressSpace: { - addressPrefixes: [ - '10.0.0.0/16' - ] - } - subnets: [ - { - name: 'subnet-01' - properties: { - addressPrefix: '10.0.0.0/24' - } - } - ] - } - tags: tags -} - -resource loadBalancerPublicIPAddress 'Microsoft.Network/publicIPAddresses@2021-03-01' = { - name: '${serviceFabricClusterName}-LB-PIP' - location: location - properties: { - dnsSettings: { - domainNameLabel: serviceFabricClusterName - } - publicIPAllocationMethod: 'Dynamic' - } - tags: tags -} - -resource loadBalancer 'Microsoft.Network/loadBalancers@2021-03-01' = { - name: '${serviceFabricClusterName}-LB' - location: location - properties: { - frontendIPConfigurations: [ - { - name: 'LoadBalancerIPConfig' - properties: { - publicIPAddress: { - id: loadBalancerPublicIPAddress.id - } - } - } - ] - backendAddressPools: [ - { - name: 'LoadBalancerBEAddressPool' - properties: {} - } - ] - loadBalancingRules: [ - { - name: 'LBRule' - properties: { - backendAddressPool: { - id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', '${serviceFabricClusterName}-LB', 'LoadBalancerBEAddressPool') - } - backendPort: 19000 - enableFloatingIP: true - frontendIPConfiguration: { - id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') - } - frontendPort: 19000 - idleTimeoutInMinutes: 5 - probe: { - id: resourceId('Microsoft.Network/loadBalancers/probes', '${serviceFabricClusterName}-LB', 'FabricGatewayProbe') - } - protocol: 'Tcp' - } - } - { - name: 'LBHttpRule' - properties: { - backendAddressPool: { - id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', '${serviceFabricClusterName}-LB', 'LoadBalancerBEAddressPool') - } - backendPort: 19080 - enableFloatingIP: false - frontendIPConfiguration: { - id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') - } - frontendPort: 19080 - idleTimeoutInMinutes: 5 - probe: { - id: resourceId('Microsoft.Network/loadBalancers/probes', '${serviceFabricClusterName}-LB', 'FabricHttpGatewayProbe') - } - protocol: 'Tcp' - } - } - { - name: 'AppPortLBRule1' - properties: { - backendAddressPool: { - id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', '${serviceFabricClusterName}-LB', 'LoadBalancerBEAddressPool') - } - backendPort: 80 - enableFloatingIP: false - frontendIPConfiguration: { - id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') - } - frontendPort: 80 - idleTimeoutInMinutes: 5 - probe: { - id: resourceId('Microsoft.Network/loadBalancers/probes', '${serviceFabricClusterName}-LB', 'AppPortProbe1') - } - protocol: 'Tcp' - } - } - { - name: 'AppPortLBRule2' - properties: { - backendAddressPool: { - id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', '${serviceFabricClusterName}-LB', 'LoadBalancerBEAddressPool') - } - backendPort: 8081 - enableFloatingIP: false - frontendIPConfiguration: { - id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') - } - frontendPort: 8081 - idleTimeoutInMinutes: 5 - probe: { - id: resourceId('Microsoft.Network/loadBalancers/probes', '${serviceFabricClusterName}-LB', 'AppPortProbe2') - } - protocol: 'Tcp' - } - } - ] - probes: [ - { - name: 'FabricGatewayProbe' - properties: { - port: 19000 - protocol: 'Tcp' - intervalInSeconds: 5 - numberOfProbes: 2 - } - } - { - name: 'FabricHttpGatewayProbe' - properties: { - port: 19080 - protocol: 'Tcp' - intervalInSeconds: 5 - numberOfProbes: 2 - } - } - { - name: 'AppPortProbe1' - properties: { - port: 80 - protocol: 'Tcp' - intervalInSeconds: 5 - numberOfProbes: 2 - } - } - { - name: 'AppPortProbe2' - properties: { - port: 8081 - protocol: 'Tcp' - intervalInSeconds: 5 - numberOfProbes: 2 - } - } - ] - inboundNatPools: [ - { - name: 'LoadBalancerBEAddressNatPool' - properties: { - backendPort: 22 - frontendIPConfiguration: { - id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', '${serviceFabricClusterName}-LB', 'LoadBalancerIPConfig') - } - frontendPortRangeEnd: 4500 - frontendPortRangeStart: 3389 - protocol: 'Tcp' - } - } - ] - } - tags: tags - dependsOn: [ - loadBalancerPublicIPAddress - ] -} - -var wadlogs = '' - -var wadperfcounters1 = '' - -var wadperfcounters2 = '' - -var wadcfgxstart = '${wadlogs}${wadperfcounters1}${wadperfcounters2} Date: Wed, 1 Dec 2021 16:46:20 +0530 Subject: [PATCH 17/50] Undo change to formatOnSave VSCode setting. --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c63f4cb6f3..8b56df2cb7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,7 +16,7 @@ "editor.tabSize": 2 }, "editor.formatOnPaste": true, - "editor.formatOnSave": false, + "editor.formatOnSave": true, "editor.insertSpaces": true, "files.insertFinalNewline": true, "files.trimTrailingWhitespace": true, From cc83c4752c5a39388a1978a64d599aacd54f3855 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 1 Dec 2021 16:47:09 +0530 Subject: [PATCH 18/50] Undo change to formatOnSave VS Code setting. --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 8b56df2cb7..c63f4cb6f3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,7 +16,7 @@ "editor.tabSize": 2 }, "editor.formatOnPaste": true, - "editor.formatOnSave": true, + "editor.formatOnSave": false, "editor.insertSpaces": true, "files.insertFinalNewline": true, "files.trimTrailingWhitespace": true, From 49ab43babb2cff07d389d48ec4f17ed715b13a33 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 1 Dec 2021 16:48:32 +0530 Subject: [PATCH 19/50] Undo change to formatOnSave VS Code setting. --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c63f4cb6f3..8b56df2cb7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,7 +16,7 @@ "editor.tabSize": 2 }, "editor.formatOnPaste": true, - "editor.formatOnSave": false, + "editor.formatOnSave": true, "editor.insertSpaces": true, "files.insertFinalNewline": true, "files.trimTrailingWhitespace": true, From 0d8812689803f16cec2f94ccc32f1cd3bc093f69 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 1 Dec 2021 18:03:29 +0530 Subject: [PATCH 20/50] Update applications bicep. --- .../clusters/applications/deploy.bicep | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep index 7c58dbd13f..09468ddaf1 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep @@ -24,9 +24,9 @@ var identity_var = { userAssignedIdentities: !empty(identity) ? identity.userAssignedIdentities : null } -var propertiesManagedIdentities_var = [for index in range(0, length(properties.managedIdentities)): { - name: properties.managedIdentities.name[index] - principalId: properties.managedIdentities.principalId[index] +var propertiesManagedIdentities_var = [for index in properties.managedIdentities :{ + name: contains(properties, 'managedIdentities') ? properties.managedIdentities[index].name : null + principalId: contains(properties, 'managedIdentities') ? properties.managedIdentities[index].principalId : null }] var propertiesMetrics_var = [for index in range(0, length(properties.metrics)): { @@ -38,14 +38,14 @@ var propertiesMetrics_var = [for index in range(0, length(properties.metrics)): var upgradePolicy_var = { applicationHealthPolicy: { - considerWarningAsError: contains(properties.upgradePolicy, 'considerWarningAsError') ? properties.upgradePolicy.considerWarningAsError : false + considerWarningAsError: contains(properties.upgradePolicy.applicationHealthPolicy, 'considerWarningAsError') ? properties.upgradePolicy.applicationHealthPolicy.considerWarningAsError : false defaultServiceTypeHealthPolicy: { - maxPercentUnhealthyPartitionsPerService: contains(properties.upgradePolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyPartitionsPerService') ? properties.upgradePolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyPartitionsPerService : 0 - maxPercentUnhealthyReplicasPerPartition: contains(properties.upgradePolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyReplicasPerPartition') ? properties.upgradePolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyReplicasPerPartition : 0 - maxPercentUnhealthyServices: contains(properties.upgradePolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyServices') ? properties.upgradePolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyServices : 0 + maxPercentUnhealthyPartitionsPerService: contains(properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyPartitionsPerService') ? properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyPartitionsPerService : 0 + maxPercentUnhealthyReplicasPerPartition: contains(properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyReplicasPerPartition') ? properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyReplicasPerPartition : 0 + maxPercentUnhealthyServices: contains(properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyServices') ? properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyServices : 0 } - maxPercentUnhealthyDeployedApplications: contains(properties.upgradePolicy, 'maxPercentUnhealthyDeployedApplications') ? properties.upgradePolicy.maxPercentUnhealthyDeployedApplications : 0 - serviceTypeHealthPolicyMap: !empty(properties.upgradePolicy.serviceTypeHealthPolicyMap) ? properties.upgradePolicy.serviceTypeHealthPolicyMap : null + maxPercentUnhealthyDeployedApplications: contains(properties.upgradePolicy.applicationHealthPolicy, 'maxPercentUnhealthyDeployedApplications') ? properties.upgradePolicy.applicationHealthPolicy.maxPercentUnhealthyDeployedApplications : 0 + serviceTypeHealthPolicyMap: !empty(properties.upgradePolicy.applicationHealthPolicy.serviceTypeHealthPolicyMap) ? properties.upgradePolicy.applicationHealthPolicy.serviceTypeHealthPolicyMap : null } forceRestart: contains(properties.upgradePolicy, 'forceRestart') ? properties.upgradePolicy.forceRestart : false recreateApplication: contains(properties.upgradePolicy, 'recreateApplication') ? properties.upgradePolicy.recreateApplication : false From 91a69636d2596d61d18ed2ef4ece7322591c4cf3 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 1 Dec 2021 18:27:15 +0530 Subject: [PATCH 21/50] Update clusters' and application's deploy.bicep file. And comment out additional params from the parameters file. --- .../clusters/applications/deploy.bicep | 16 ++++++++-------- .../clusters/deploy.bicep | 10 ++++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep index 09468ddaf1..0ab00ba674 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep @@ -24,16 +24,16 @@ var identity_var = { userAssignedIdentities: !empty(identity) ? identity.userAssignedIdentities : null } -var propertiesManagedIdentities_var = [for index in properties.managedIdentities :{ - name: contains(properties, 'managedIdentities') ? properties.managedIdentities[index].name : null - principalId: contains(properties, 'managedIdentities') ? properties.managedIdentities[index].principalId : null +var propertiesManagedIdentities_var = [for managedIdentity in properties.managedIdentities :{ + name: contains(managedIdentity, 'name') ? managedIdentity.name : null + principalId: contains(managedIdentity, 'principalId') ? managedIdentity.principalId : null }] -var propertiesMetrics_var = [for index in range(0, length(properties.metrics)): { - maximumCapacity: contains(properties.metrics, 'maximumCapacity') ? properties.metrics.maximumCapacity : 0 - name: !empty(properties.metrics.name) ? properties.metrics.name : null - reservationCapacity: contains(properties.metrics, 'reservationCapacity') ? properties.metrics.reservationCapacity : 0 - totalApplicationCapacity: contains(properties.metrics, 'totalApplicationCapacity') ? properties.metrics.totalApplicationCapacity : 1 +var propertiesMetrics_var = [for metric in properties.metrics: { + maximumCapacity: contains(metric, 'maximumCapacity') ? metric.maximumCapacity : 0 + name: !empty(metric.name) ? metric.name : null + reservationCapacity: contains(metric, 'reservationCapacity') ? metric.reservationCapacity : 0 + totalApplicationCapacity: contains(metric, 'totalApplicationCapacity') ? metric.totalApplicationCapacity : 1 }] var upgradePolicy_var = { diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index ddaff2393c..0b64c1a34e 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -146,7 +146,7 @@ var azureActiveDirectory_var = { var certificate_var = { thumbprint: !empty(certificate) ? certificate.thumbprint : null - thumbprintSecondary: !empty(certificate) ? certificate.thumbprintSecondary : null + //thumbprintSecondary: !empty(certificate) ? certificate.thumbprintSecondary : null x509StoreName: !empty(certificate) ? certificate.x509StoreName : null } @@ -314,7 +314,7 @@ module serviceFabricCluster_rbac '.bicep/nested_rbac.bicep' = [for (roleAssignme // Service Fabric cluster application types module serviceFabricCluster_applicationTypes 'applicationTypes/deploy.bicep' = [for applicationType in serviceFabricClusterApplicationTypes: { - name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-${applicationType.name}' + name: '${uniqueString(deployment().name, location)}-SFC-${applicationType.name}' params: { applicationTypeName: applicationType.name serviceFabricClusterName: serviceFabricCluster.name @@ -326,10 +326,10 @@ module serviceFabricCluster_applicationTypes 'applicationTypes/deploy.bicep' = [ // Service Fabric cluster applications module serviceFabricCluster_applications 'applications/deploy.bicep' = [for application in serviceFabricClusterApplications: { - name: '${uniqueString(deployment().name, location)}-ServiceFabricCluster-${application.name}' + name: '${uniqueString(deployment().name, location)}-SFC-${application.name}' params: { serviceFabricClusterName: serviceFabricCluster.name - applicationName: application.name + applicationName: contains(application, 'name') ? application.name : 'defaultApplication' identity: contains(application, 'identity') ? application.identity : {} properties: contains(application, 'properties') ? application.properties : {} tags: tags @@ -342,7 +342,9 @@ module serviceFabricCluster_applications 'applications/deploy.bicep' = [for appl // Outputs section @description('The Service Fabric Cluster Object.') output serviceFabricCluster object = serviceFabricCluster + @description('The Service Fabric Cluster resource group.') output serviceFabricClusterResourceGroup string = resourceGroup().name + @description('The Service Fabric Cluster endpoint.') output clusterEndpoint string = serviceFabricCluster.properties.clusterEndpoint From c328cfcc4b26061355559f4400f344a3a58e2c68 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Wed, 1 Dec 2021 18:28:46 +0530 Subject: [PATCH 22/50] Updated (commented additional params) parameter file. --- .../clusters/parameters/parameters.json | 308 +++++++++--------- 1 file changed, 154 insertions(+), 154 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json index 93e141608f..abf9c07422 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json @@ -3,7 +3,7 @@ "contentVersion": "1.0.0.0", "parameters": { "serviceFabricClusterName": { - "value": "sxx-az-sfc-weu-x-666" + "value": "sxx-az-sfc-weu-x-001" }, "location": { "value": "centralIndia" @@ -11,7 +11,7 @@ "tags": { "value": { "resourceType": "Service Fabric", - "clusterName": "sxx-az-sfc-weu-x-666" + "clusterName": "sxx-az-sfc-weu-x-001" } }, "lock": { @@ -23,57 +23,57 @@ "maxUnusedVersionsToKeep": { "value": 2 }, - "azureActiveDirectory": { - "value": { - "clientApplication": "", - "clusterApplication": "", - "tenantId": "" - } - }, + // "azureActiveDirectory": { + // "value": { + // "clientApplication": "", + // "clusterApplication": "", + // "tenantId": "" + // } + // }, "certificate": { "value": { - "thumbprint": "154813CEE741AEC28CAE17FC16FB30888FACF3", - "thumbprintSecondary": "", + "thumbprint": "0AC113D5E1D94C401DDEB0EE1E8EE2B1B96CC130", + //"thumbprintSecondary": "", "x509StoreName": "My" } }, - "certificateCommonNames": { - "value": { - "commonNames": [ - { - "certificateCommonName": "", - "certificateIssuerThumbprint": "" - } - ], - "x509StoreName": "" - } - }, - "clientCertificateCommonNames": { - "value": [{ - "certificateCommonName": "", - "certificateIssuerThumbprint": "", - "isAdmin": "" - }] - }, - "clientCertificateThumbprints": { - "value": [{ - "certificateThumbprint": "", - "isAdmin": "" - }] - }, - "clusterCodeVersion": { - "value": "8.1.329.9590" - }, - "diagnosticsStorageAccountConfig": { - "value": { - "blobEndpoint": "", - "protectedAccountKeyName": "", - "protectedAccountKeyName2": "", - "queueEndpoint": "", - "storageAccountName": "", - "tableEndpoint": "" - } - }, + // "certificateCommonNames": { + // "value": { + // "commonNames": [ + // { + // "certificateCommonName": "", + // "certificateIssuerThumbprint": "" + // } + // ], + // "x509StoreName": "" + // } + // }, + // "clientCertificateCommonNames": { + // "value": [{ + // "certificateCommonName": "", + // "certificateIssuerThumbprint": "", + // "isAdmin": "" + // }] + // }, + // "clientCertificateThumbprints": { + // "value": [{ + // "certificateThumbprint": "", + // "isAdmin": "" + // }] + // }, + // "clusterCodeVersion": { + // "value": "8.1.329.9590" + // }, + // "diagnosticsStorageAccountConfig": { + // "value": { + // "blobEndpoint": "", + // "protectedAccountKeyName": "", + // "protectedAccountKeyName2": "", + // "queueEndpoint": "", + // "storageAccountName": "", + // "tableEndpoint": "" + // } + // }, "fabricSettings": { "value": [ { @@ -88,7 +88,7 @@ ] }, "managementEndpoint": { - "value": "https://sxx-az-sfc-weu-x-666.centralindia.cloudapp.azure.com:19080" + "value": "https://sxx-az-sfc-weu-x-001.centralindia.cloudapp.azure.com:19080" }, "nodeTypes": { "value": [ @@ -108,24 +108,24 @@ "isPrimary": true, "isStateless": false, "multipleAvailabilityZones": false, - "name": "666Node01", + "name": "001Node01", "placementProperties": {}, "reverseProxyEndpointPort": "", "vmInstanceCount": 5 } ] }, - "notifications": { - "value": [{ - "isEnabled": "", - "notificationCategory": "", - "notificationLevel": "", - "notificationTargets": [{ - "notificationChannel": "", - "receivers": "" - }] - }] - }, + // "notifications": { + // "value": [{ + // "isEnabled": "", + // "notificationCategory": "", + // "notificationLevel": "", + // "notificationTargets": [{ + // "notificationChannel": "", + // "receivers": "" + // }] + // }] + // }, "reliabilityLevel": { "value": "Silver" }, @@ -141,98 +141,98 @@ ] } ] - }, - "serviceFabricClusterApplications": { - "value": [ - { - "name": "serviceFabricClusterApplication01", - "identity": { - "type": "None", - "userAssignedIdentities": {} - }, - "properties": { - "managedIdentities": [ - { - "name": "Identity_Friendly_Name", - "principalId": "6bffd5f5-80d9-435c-903e-78354538a902" - } - ], - "maximumNodes": 2, - "metrics": [ - { - "maximumCapacity": null, - "name": null, - "reservationCapacity": null, - "totalApplicationCapacity": null - } - ], - "minimumNodes": null, - "parameters": {}, - "removeApplicationCapacity": "", - "typeName": "DotNetCore", - "typeVersion": "VersionOne", - "upgradePolicy": { - "applicationHealthPolicy": { - "considerWarningAsError": "", - "defaultServiceTypeHealthPolicy": { - "maxPercentUnhealthyPartitionsPerService": null, - "maxPercentUnhealthyReplicasPerPartition": null, - "maxPercentUnhealthyServices": null - }, - "maxPercentUnhealthyDeployedApplications": null, - "serviceTypeHealthPolicyMap": {} - }, - "forceRestart": "", - "recreateApplication": "", - "rollingUpgradeMonitoringPolicy": { - "failureAction": null, - "healthCheckRetryTimeout": null, - "healthCheckStableDuration": null, - "healthCheckWaitDuration": null, - "upgradeDomainTimeout": null, - "upgradeTimeout": null - }, - "upgradeMode": "UnmonitoredAuto", - "upgradeReplicaSetCheckTimeout": null - } - }, - "applicationsServices": { - "value": [ - { - "name": "Service01", - "properties": { - "provisioningState": "Default", - "correlationScheme": [ - { - "scheme": "Invalid", - "serviceName": "fabric:service01" - } - ] - } - } - ] - } - } - ] - }, - "serviceFabricApplicationTypes": { - "value": [ - { - "name": "DotNetCore", - "properties": { - "provisioningState": "Default" - }, - "applicationTypesVersions": [ - { - "name": "VersionOne", - "properties": { - "provisioningState": "Default", - "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/blob/master/WordCountV1.sfpkg" - } - } - ] - } - ] - } + }//, + // "serviceFabricClusterApplications": { + // "value": [ + // { + // "name": "serviceFabricClusterApplication01", + // "identity": { + // "type": "None", + // "userAssignedIdentities": {} + // }, + // "properties": { + // "managedIdentities": [ + // { + // "name": "Identity_Friendly_Name", + // "principalId": "6bffd5f5-80d9-435c-903e-78354538a902" + // } + // ], + // "maximumNodes": 2, + // "metrics": [ + // { + // "maximumCapacity": null, + // "name": null, + // "reservationCapacity": null, + // "totalApplicationCapacity": null + // } + // ], + // "minimumNodes": null, + // "parameters": {}, + // "removeApplicationCapacity": "", + // "typeName": "DotNetCore", + // "typeVersion": "VersionOne", + // "upgradePolicy": { + // "applicationHealthPolicy": { + // "considerWarningAsError": "", + // "defaultServiceTypeHealthPolicy": { + // "maxPercentUnhealthyPartitionsPerService": null, + // "maxPercentUnhealthyReplicasPerPartition": null, + // "maxPercentUnhealthyServices": null + // }, + // "maxPercentUnhealthyDeployedApplications": null, + // "serviceTypeHealthPolicyMap": {} + // }, + // "forceRestart": "", + // "recreateApplication": "", + // "rollingUpgradeMonitoringPolicy": { + // "failureAction": null, + // "healthCheckRetryTimeout": null, + // "healthCheckStableDuration": null, + // "healthCheckWaitDuration": null, + // "upgradeDomainTimeout": null, + // "upgradeTimeout": null + // }, + // "upgradeMode": "UnmonitoredAuto", + // "upgradeReplicaSetCheckTimeout": null + // } + // }, + // "applicationsServices": { + // "value": [ + // { + // "name": "Service01", + // "properties": { + // "provisioningState": "Default", + // "correlationScheme": [ + // { + // "scheme": "Invalid", + // "serviceName": "fabric:service01" + // } + // ] + // } + // } + // ] + // } + // } + // ] + // }, + // "serviceFabricClusterApplicationTypes": { + // "value": [ + // { + // "name": "DotNetCore", + // "properties": { + // "provisioningState": "Default" + // }, + // "applicationTypesVersions": [ + // { + // "name": "VersionOne", + // "properties": { + // "provisioningState": "Default", + // "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/blob/master/WordCountV1.sfpkg" + // } + // } + // ] + // } + // ] + // } } } From 6ff35bfc161bd9de7b68544482b8ef929cfda1eb Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Fri, 3 Dec 2021 16:23:29 +0530 Subject: [PATCH 23/50] Resolve PR comments. --- .../parameters.json | 90 +++++++++---------- .../clusters/applicationTypes/deploy.bicep | 20 +++-- .../applicationTypes/versions/deploy.bicep | 15 +++- .../clusters/applications/deploy.bicep | 30 +++++-- .../applications/services/deploy.bicep | 58 ++++++++++-- .../clusters/deploy.bicep | 67 +++++++------- 6 files changed, 179 insertions(+), 101 deletions(-) rename arm/Microsoft.ServiceFabric/clusters/{parameters => .parameters}/parameters.json (80%) diff --git a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json similarity index 80% rename from arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json rename to arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index abf9c07422..0f5106890f 100644 --- a/arm/Microsoft.ServiceFabric/clusters/parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -2,7 +2,7 @@ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "parameters": { - "serviceFabricClusterName": { + "name": { "value": "sxx-az-sfc-weu-x-001" }, "location": { @@ -32,7 +32,7 @@ // }, "certificate": { "value": { - "thumbprint": "0AC113D5E1D94C401DDEB0EE1E8EE2B1B96CC130", + "thumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", //"thumbprintSecondary": "", "x509StoreName": "My" } @@ -75,45 +75,39 @@ // } // }, "fabricSettings": { - "value": [ - { - "name": "Security", - "parameters": [ - { - "name": "ClusterProtectionLevel", - "value": "EncryptAndSign" - } - ] - } - ] + "value": [{ + "name": "Security", + "parameters": [{ + "name": "ClusterProtectionLevel", + "value": "EncryptAndSign" + }] + }] }, "managementEndpoint": { "value": "https://sxx-az-sfc-weu-x-001.centralindia.cloudapp.azure.com:19080" }, "nodeTypes": { - "value": [ - { - "applicationPorts": { - "endPort": 30000, - "startPort": 20000 - }, - "capacities": {}, - "clientConnectionEndpointPort": 19000, - "durabilityLevel": "Silver", - "ephemeralPorts": { - "endPort": 65534, - "startPort": 49152 - }, - "httpGatewayEndpointPort": 19080, - "isPrimary": true, - "isStateless": false, - "multipleAvailabilityZones": false, - "name": "001Node01", - "placementProperties": {}, - "reverseProxyEndpointPort": "", - "vmInstanceCount": 5 - } - ] + "value": [{ + "applicationPorts": { + "endPort": 30000, + "startPort": 20000 + }, + "capacities": {}, + "clientConnectionEndpointPort": 19000, + "durabilityLevel": "Silver", + "ephemeralPorts": { + "endPort": 65534, + "startPort": 49152 + }, + "httpGatewayEndpointPort": 19080, + "isPrimary": true, + "isStateless": false, + "multipleAvailabilityZones": false, + "name": "001Node01", + "placementProperties": {}, + "reverseProxyEndpointPort": "", + "vmInstanceCount": 5 + }] }, // "notifications": { // "value": [{ @@ -133,16 +127,14 @@ "value": "Linux" }, "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "6bffd5f5-80d9-435c-903e-78354538a902" - ] - } - ] - }//, - // "serviceFabricClusterApplications": { + "value": [{ + "roleDefinitionIdOrName": "Reader", + "principalIds": [ + "6bffd5f5-80d9-435c-903e-78354538a902" + ] + }] + } //, + // "applications": { // "value": [ // { // "name": "serviceFabricClusterApplication01", @@ -196,7 +188,7 @@ // "upgradeReplicaSetCheckTimeout": null // } // }, - // "applicationsServices": { + // "services": { // "value": [ // { // "name": "Service01", @@ -215,14 +207,14 @@ // } // ] // }, - // "serviceFabricClusterApplicationTypes": { + // "applicationTypes": { // "value": [ // { // "name": "DotNetCore", // "properties": { // "provisioningState": "Default" // }, - // "applicationTypesVersions": [ + // "versions": [ // { // "name": "VersionOne", // "properties": { diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep index 5d6a15dfc0..24be21dcf8 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep @@ -2,7 +2,7 @@ param serviceFabricClusterName string = '' @description('Optional. Application type name.') -param applicationTypeName string = 'defaultApplicationType' +param name string = 'defaultApplicationType' @description('Optional. Array of Versions to create.') param versions array = [] @@ -29,20 +29,26 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' exis } resource applicationTypes 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = { - name: applicationTypeName + name: name + parent: serviceFabricCluster location: location tags: tags properties: !empty(properties) ? properties : null - parent: serviceFabricCluster } module applicationTypes_versions 'versions/deploy.bicep' = [for (version, index) in versions: { - name: '${deployment().name}-ServiceFabricCluster-Versions-${index}' + name: '${deployment().name}-SFC-Versions-${index}' params: { appPackageUrl: contains(versions, 'appPackageUrl') ? version.appPackageUrl : null - applicationTypeVersionName: contains(versions, 'applicationTypeVersionName') ? version.applicationTypeVersionName : null + name: contains(versions, 'applicationTypeVersionName') ? version.applicationTypeVersionName : null } }] -@description('The resource Id of the application type.') -output applicationTypeResourceId string = applicationTypes.id +@description('The resource name of the Application type.') +output applicationTypeName string = applicationTypes.name + +@description('The resource group of the Application type.') +output applicationTypeResourceGroup string = resourceGroup().name + +@description('The resource ID of the Application type.') +output applicationTypeResourceID string = applicationTypes.id diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep index 4924c0bdd1..7606c126f0 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep @@ -5,7 +5,7 @@ param serviceFabricClusterName string = '' param applicationTypeName string = 'default' @description('The name of the application type version') -param applicationTypeVersionName string +param name string = 'defaultVersion' @description('Optional. Location for all resources.') param location string = resourceGroup().location @@ -33,11 +33,20 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' exis } resource versions 'Microsoft.ServiceFabric/clusters/applicationTypes/versions@2021-06-01' = { - name: applicationTypeVersionName + name: name + parent: serviceFabricCluster::applicationTypes location: location tags: tags - parent: serviceFabricCluster::applicationTypes properties: { appPackageUrl: appPackageUrl } } + +@description('The name of the Version.') +output versionName string = versions.name + +@description('The resource group of the Version.') +output versionResourceGroup string = resourceGroup().name + +@description('The resource ID of the Version.') +output versionResourceId string = versions.id diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep index 0ab00ba674..83bcb7c3f7 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep @@ -2,11 +2,14 @@ param serviceFabricClusterName string = '' @description('Optional. Application name.') -param applicationName string = 'defaultApplication' +param name string = 'defaultApplication' @description('Optional. Location for all resources.') param location string = resourceGroup().location +@description('Optional. List of Services to be created in the Application.') +param services array = [] + @description('Optional. Tags of the resource.') param tags object = {} @@ -24,7 +27,7 @@ var identity_var = { userAssignedIdentities: !empty(identity) ? identity.userAssignedIdentities : null } -var propertiesManagedIdentities_var = [for managedIdentity in properties.managedIdentities :{ +var propertiesManagedIdentities_var = [for managedIdentity in properties.managedIdentities: { name: contains(managedIdentity, 'name') ? managedIdentity.name : null principalId: contains(managedIdentity, 'principalId') ? managedIdentity.principalId : null }] @@ -71,9 +74,9 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' exis } resource applications 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = { - name: applicationName - location: location + name: name parent: serviceFabricCluster + location: location tags: tags identity: !empty(identity) ? identity_var : null properties: { @@ -89,6 +92,21 @@ resource applications 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' } } -// Output -@description('The resource Id of the application.') +module applications_services 'services/deploy.bicep' = [for (service, index) in services: { + name: '${deployment().name}-SFC-Services-${index}' + params: { + serviceFabricClusterName: serviceFabricCluster.name + applicationName: applications.name + name: contains(service, 'name') ? service.name : 'defaultService' + properties: contains(service, 'properties') ? service.properties : {} + } +}] + +@description('The resource name of the Application.') +output applicationName string = applications.name + +@description('The resource group of the Application.') +output applicationResourceGroup string = resourceGroup().name + +@description('The resource ID of the Application.') output applicationResourceId string = applications.id diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep index 1979649b59..455e189873 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep @@ -2,10 +2,13 @@ param serviceFabricClusterName string = '' @description('Optional. Application name.') -param applicationName string = 'default' +param applicationName string = 'defaultApplication' @description('Optional. Name of the Service.') -param serviceName string = 'default' +param name string = 'defaultService' + +@description('Optional. Properties of the Service.') +param properties object = {} @description('Optional. Location for all resources.') param location string = resourceGroup().location @@ -16,6 +19,42 @@ param tags object = {} @description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered') param cuaId string = '' +var correlationScheme_var = [for correlationScheme in items(properties.value.correlationScheme): { + scheme: !empty(correlationScheme.value.scheme) ? '${correlationScheme.value.scheme}' : null + serviceName: !empty(correlationScheme.value.serviceName) ? '${correlationScheme.value.serviceName}' : null +}] + +var serviceLoadMetrics_var = [for serviceLoadMetric in items(properties.value.serviceLoadMetrics): { + defaultLoad: contains(serviceLoadMetric, 'defaultLoad') ? serviceLoadMetric.value.defaultLoad : 1 + name: !empty(serviceLoadMetric.value.name) ? '${serviceLoadMetric.value.name}' : null + primaryDefaultLoad: contains(serviceLoadMetric, 'primaryDefaultLoad') ? serviceLoadMetric.value.primaryDefaultLoad : 1 + secondaryDefaultLoad: contains(serviceLoadMetric, 'secondaryDefaultLoad') ? serviceLoadMetric.value.secondaryDefaultLoad : 1 + weight: !empty(serviceLoadMetric.value.weight) ? '${serviceLoadMetric.value.weight}' : null +}] + +var properties_var = { + correlationScheme: !empty(correlationScheme_var) ? correlationScheme_var : [] + defaultMoveCost: !empty(properties.defaultMoveCost) ? '${properties.defaultMoveCost}' : null + partitionDescription: { + partitionScheme: !empty(properties.partitionDescription.partitionScheme) ? '${properties.partitionDescription.partitionScheme}' : null + count: contains(properties.partitionDescription, 'count') ? properties.partitionDescription.count : 1 + names: !empty(properties.partitionDescription.names) ? properties.partitionDescription.names : [] + } + placementConstraints: !empty(properties.placementConstraints) ? '${properties.placementConstraints}' : null + serviceDnsName: !empty(properties.serviceDnsName) ? '${properties.serviceDnsName}' : null + serviceLoadMetrics: !empty(properties.serviceLoadMetrics) ? serviceLoadMetrics_var : [] + servicePackageActivationMode: !empty(properties.servicePackageActivationMode) ? '${properties.servicePackageActivationMode}' : null + servicePlacementPolicies: !empty(properties.servicePlacementPolicies) ? properties.servicePlacementPolicies : [] + serviceTypeName: !empty(properties.serviceTypeName) ? '${properties.serviceTypeName}' : null + serviceKind: !empty(properties.serviceKind) ? '${properties.serviceKind}' : null + hasPersistedState: contains(properties, 'hasPersistedState') ? properties.hasPersistedState : true + minReplicaSetSize: contains(properties, 'minReplicaSetSize') ? properties.minReplicaSetSize : 1 + quorumLossWaitDuration: !empty(properties.quorumLossWaitDuration) ? '${properties.quorumLossWaitDuration}' : null + replicaRestartWaitDuration: !empty(properties.replicaRestartWaitDuration) ? '${properties.replicaRestartWaitDuration}' : null + standByReplicaKeepDuration: !empty(properties.standByReplicaKeepDuration) ? '${properties.standByReplicaKeepDuration}' : null + targetReplicaSetSize: contains(properties, 'targetReplicaSetSize') ? properties.targetReplicaSetSize : 1 +} + module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { name: 'pid-${cuaId}' params: {} @@ -30,9 +69,18 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' exis } resource services 'Microsoft.ServiceFabric/clusters/applications/services@2021-06-01' = { - name: serviceName + name: name + parent: serviceFabricCluster::applications location: location tags: tags - parent: serviceFabricCluster::applications - properties: {} + properties: !empty(properties) ? properties_var : {} } + +@description('The resource name of the service.') +output serviceName string = services.name + +@description('The resource group of the service.') +output serviceResourceGroup string = resourceGroup().name + +@description('The resource ID of the service.') +output serviceResourceId string = services.id diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 0b64c1a34e..ab7e32a01f 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -1,5 +1,5 @@ @description('Required. Name of the Serivce Fabric cluster.') -param serviceFabricClusterName string = '' +param name string = '' @description('Optional. Location for all resources.') param location string = resourceGroup().location @@ -133,10 +133,10 @@ param waveUpgradePaused bool = false param roleAssignments array = [] @description('Optional. Array of Service Fabric cluster applications.') -param serviceFabricClusterApplications array = [] +param applications array = [] @description('Optional. Array of Service Fabric cluster application types.') -param serviceFabricClusterApplicationTypes array = [] +param applicationTypes array = [] var azureActiveDirectory_var = { clientApplication: !empty(azureActiveDirectory) ? azureActiveDirectory.clientApplication : null @@ -150,8 +150,8 @@ var certificate_var = { x509StoreName: !empty(certificate) ? certificate.x509StoreName : null } -var certificateCommonNamesList_var = [for index in range(0, (!empty(certificateCommonNames) ? length(certificateCommonNames.commonNames) : 0)): { - commonNames: certificateCommonNames.commonNames[index] +var certificateCommonNamesList_var = [for certificateCommonName in items(certificateCommonNames): { + commonNames: !empty(certificateCommonName.value.commonNames) ? certificateCommonName.value.commonNames : [] }] var certificateCommonNames_var = { @@ -159,15 +159,15 @@ var certificateCommonNames_var = { x509StoreName: !empty(certificateCommonNames) ? certificateCommonNames.x509StoreName : null } -var clientCertificateCommonNames_var = [for index in range(0, (!empty(clientCertificateCommonNames) ? length(clientCertificateCommonNames) : 0)): { - certificateCommonName: !empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateCommonName}' : null - certificateIssuerThumbprint: !empty(clientCertificateCommonNames) ? '${clientCertificateCommonNames[index].certificateIssuerThumbprint}' : null - isAdmin: !empty(clientCertificateCommonNames) ? clientCertificateCommonNames[index].isAdmin : null +var clientCertificateCommonNames_var = [for clientCertificateCommonName in clientCertificateCommonNames: { + certificateCommonName: !empty(clientCertificateCommonName.certificateCommonName) ? '${clientCertificateCommonName.certificateCommonName}' : null + certificateIssuerThumbprint: !empty(clientCertificateCommonName.certificateIssuerThumbprint) ? '${clientCertificateCommonName.certificateIssuerThumbprint}' : null + isAdmin: contains(clientCertificateCommonName, 'isAdmin') ? clientCertificateCommonName.isAdmin : false }] -var clientCertificateThumbprints_var = [for index in range(0, (!empty(clientCertificateThumbprints) ? length(clientCertificateThumbprints) : 0)): { - certificateThumbprint: !empty(clientCertificateThumbprints) ? '${clientCertificateThumbprints[index].certificateThumbprint}' : null - isAdmin: !empty(clientCertificateThumbprints) ? clientCertificateThumbprints[index].isAdmin : null +var clientCertificateThumbprints_var = [for clientCertificateThumbprint in clientCertificateThumbprints: { + certificateThumbprint: !empty(clientCertificateThumbprint.certificateThumbprint) ? '${clientCertificateThumbprint.certificateThumbprint}' : null + isAdmin: contains(clientCertificateThumbprint, 'isAdmin') ? clientCertificateThumbprint.isAdmin : false }] var diagnosticsStorageAccountConfig_var = { @@ -179,9 +179,9 @@ var diagnosticsStorageAccountConfig_var = { tableEndpoint: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.tableEndpoint : null } -var fabricSettings_var = [for index in range(0, (!empty(fabricSettings) ? length(fabricSettings) : 0)): { - name: !empty(fabricSettings) ? fabricSettings[index].name : null - parameters: !empty(fabricSettings) ? fabricSettings[index].parameters : null +var fabricSettings_var = [for fabricSetting in fabricSettings: { + name: !empty(fabricSetting.name) ? fabricSetting.name : null + parameters: !empty(fabricSetting.parameters) ? fabricSetting.parameters : null }] var nodeTypes_var = [for nodeType in nodeTypes: { @@ -206,11 +206,11 @@ var nodeTypes_var = [for nodeType in nodeTypes: { vmInstanceCount: contains(nodeType, 'vmInstanceCount') ? nodeType.vmInstanceCount : 1 }] -var notifications_var = [for index in range(0, (!empty(notifications) ? length(notifications) : 0)): { - isEnabled: !empty(notifications) ? notifications[index].isEnabled : null - notificationCategory: !empty(notifications) ? notifications[index].notificationCategory : null - notificationLevel: !empty(notifications) ? notifications[index].notificationLevel : null - notificationTargets: !empty(notifications) ? notifications[index].notificationTargets : null +var notifications_var = [for notification in notifications: { + isEnabled: contains(notification, 'isEnabled') ? notification.isEnabled : false + notificationCategory: !empty(notification.notificationCategory) ? notification.notificationCategory : 'WaveProgress' + notificationLevel: !empty(notification.notificationLevel) ? notification.notificationLevel : 'All' + notificationTargets: !empty(notification.notificationTargets) ? notification.notificationTargets : [] }] var reverseProxyCertificate_var = { @@ -219,8 +219,8 @@ var reverseProxyCertificate_var = { x509StoreName: !empty(reverseProxyCertificate) ? reverseProxyCertificate.x509StoreName : null } -var reverseProxyCertificateCommonNamesList_var = [for index in range(0, (!empty(reverseProxyCertificateCommonNames) ? length(reverseProxyCertificateCommonNames.commonNames) : 0)): { - commonNames: reverseProxyCertificateCommonNames.commonNames[index] +var reverseProxyCertificateCommonNamesList_var = [for reverseProxyCertificateCommonName in items(reverseProxyCertificateCommonNames): { + commonNames: reverseProxyCertificateCommonName.value.commonNames }] var reverseProxyCertificateCommonNames_var = { @@ -235,7 +235,7 @@ var upgradeDescription_var = { maxPercentDeltaUnhealthyNodes: !empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyNodes : null maxPercentUpgradeDomainDeltaUnhealthyNodes: !empty(upgradeDescription) ? upgradeDescription.maxPercentUpgradeDomainDeltaUnhealthyNodes : null } - forceRestart: '${!empty(upgradeDescription) ? upgradeDescription.forceRestart : null}' + forceRestart: !empty(upgradeDescription) ? upgradeDescription.forceRestart : null healthCheckRetryTimeout: '${!empty(upgradeDescription) ? upgradeDescription.healthCheckRetryTimeout : null}' healthCheckStableDuration: '${!empty(upgradeDescription) ? upgradeDescription.healthCheckStableDuration : null}' healthCheckWaitDuration: '${!empty(upgradeDescription) ? upgradeDescription.healthCheckWaitDuration : null}' @@ -256,7 +256,7 @@ module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { // Service Fabric cluster resource resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { - name: serviceFabricClusterName + name: name location: location tags: tags properties: { @@ -297,7 +297,7 @@ resource serviceFabricCluster_lock 'Microsoft.Authorization/locks@2016-09-01' = name: '${serviceFabricCluster.name}-${lock}-lock' properties: { level: lock - notes: (lock == 'CanNotDelete') ? 'Cannot delete resource or child resources.' : 'Cannot modify the resource or child resources.' + notes: lock == 'CanNotDelete' ? 'Cannot delete resource or child resources.' : 'Cannot modify the resource or child resources.' } scope: serviceFabricCluster } @@ -313,10 +313,10 @@ module serviceFabricCluster_rbac '.bicep/nested_rbac.bicep' = [for (roleAssignme }] // Service Fabric cluster application types -module serviceFabricCluster_applicationTypes 'applicationTypes/deploy.bicep' = [for applicationType in serviceFabricClusterApplicationTypes: { +module serviceFabricCluster_applicationTypes 'applicationTypes/deploy.bicep' = [for applicationType in applicationTypes: { name: '${uniqueString(deployment().name, location)}-SFC-${applicationType.name}' params: { - applicationTypeName: applicationType.name + name: applicationType.name serviceFabricClusterName: serviceFabricCluster.name properties: contains(applicationType, 'properties') ? applicationType.properties : {} tags: tags @@ -325,13 +325,14 @@ module serviceFabricCluster_applicationTypes 'applicationTypes/deploy.bicep' = [ }] // Service Fabric cluster applications -module serviceFabricCluster_applications 'applications/deploy.bicep' = [for application in serviceFabricClusterApplications: { +module serviceFabricCluster_applications 'applications/deploy.bicep' = [for application in applications: { name: '${uniqueString(deployment().name, location)}-SFC-${application.name}' params: { serviceFabricClusterName: serviceFabricCluster.name - applicationName: contains(application, 'name') ? application.name : 'defaultApplication' + name: contains(application, 'name') ? application.name : 'defaultApplication' identity: contains(application, 'identity') ? application.identity : {} properties: contains(application, 'properties') ? application.properties : {} + services: contains(application, 'applicationsServices') ? application.applicationsServices : [] tags: tags } dependsOn: [ @@ -339,12 +340,16 @@ module serviceFabricCluster_applications 'applications/deploy.bicep' = [for appl ] }] -// Outputs section -@description('The Service Fabric Cluster Object.') +@description('The Service Fabric Cluster name.') +output serviceFabricClusterName string = serviceFabricCluster.name +@description('The Service Fabric Cluster object.') output serviceFabricCluster object = serviceFabricCluster @description('The Service Fabric Cluster resource group.') output serviceFabricClusterResourceGroup string = resourceGroup().name +@description('The Service Fabric Cluster resource ID.') +output serviceFabricClusterId string = serviceFabricCluster.id + @description('The Service Fabric Cluster endpoint.') output clusterEndpoint string = serviceFabricCluster.properties.clusterEndpoint From 8fe76f0db3ec273e82bb8f22d0fc3a7cccc92b95 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Fri, 3 Dec 2021 16:36:28 +0530 Subject: [PATCH 24/50] Add Readme files and update output names for cluster resource. --- .../clusters/applicationTypes/readme.md | 57 ++++++++++++++++++ .../applicationTypes/versions/readme.md | 55 ++++++++++++++++++ .../clusters/applications/readme.md | 58 +++++++++++++++++++ .../clusters/applications/services/readme.md | 55 ++++++++++++++++++ .../clusters/deploy.bicep | 8 +-- .../clusters/readme.md | 47 +++++++++------ 6 files changed, 259 insertions(+), 21 deletions(-) create mode 100644 arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md create mode 100644 arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/readme.md create mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/readme.md create mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/services/readme.md diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md new file mode 100644 index 0000000000..a8ed8f7c67 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md @@ -0,0 +1,57 @@ +# ServiceFabric Clusters ApplicationTypes `[Microsoft.ServiceFabric/clusters/applicationTypes]` + +This module deploys ServiceFabric Clusters ApplicationTypes. +// TODO: Replace Resource and fill in description + +## Resource Types + +| Resource Type | API Version | +| :-- | :-- | +| `Microsoft.ServiceFabric/clusters/applicationTypes` | 2021-06-01 | +| `Microsoft.ServiceFabric/clusters/applicationTypes/versions` | 2021-06-01 | + +## Parameters + +| Parameter Name | Type | Default Value | Possible Values | Description | +| :-- | :-- | :-- | :-- | :-- | +| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | +| `location` | string | `[resourceGroup().location]` | | Optional. Location for all resources. | +| `name` | string | `defaultApplicationType` | | Optional. Application type name. | +| `properties` | object | `{object}` | | Optional. The application type name properties. | +| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | +| `tags` | object | `{object}` | | Optional. Tags of the resource. | +| `versions` | _[versions](versions/readme.md)_ array | `[]` | | Optional. Array of Versions to create. | + +### Parameter Usage: `` + +// TODO: Fill in Parameter usage + +### Parameter Usage: `tags` + +Tag names and tag values can be provided as needed. A tag can be left without a value. + +```json +"tags": { + "value": { + "Environment": "Non-Prod", + "Contact": "test.user@testcompany.com", + "PurchaseOrder": "1234", + "CostCenter": "7890", + "ServiceName": "DeploymentValidation", + "Role": "DeploymentValidation" + } +} +``` + +## Outputs + +| Output Name | Type | Description | +| :-- | :-- | :-- | +| `applicationTypeName` | string | The resource name of the Application type. | +| `applicationTypeResourceGroup` | string | The resource group of the Application type. | +| `applicationTypeResourceID` | string | The resource ID of the Application type. | + +## Template references + +- [Clusters/Applicationtypes](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes) +- [Clusters/Applicationtypes/Versions](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes/versions) diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/readme.md b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/readme.md new file mode 100644 index 0000000000..ec969bc6bf --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/readme.md @@ -0,0 +1,55 @@ +# ServiceFabric Clusters ApplicationTypes Versions `[Microsoft.ServiceFabric/clusters/applicationTypes/versions]` + +This module deploys ServiceFabric Clusters ApplicationTypes Versions. +// TODO: Replace Resource and fill in description + +## Resource Types + +| Resource Type | API Version | +| :-- | :-- | +| `Microsoft.ServiceFabric/clusters/applicationTypes/versions` | 2021-06-01 | + +## Parameters + +| Parameter Name | Type | Default Value | Possible Values | Description | +| :-- | :-- | :-- | :-- | :-- | +| `applicationTypeName` | string | `default` | | Optional. Application type name. | +| `appPackageUrl` | string | | | Required. The URL to the application package. | +| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | +| `location` | string | `[resourceGroup().location]` | | Optional. Location for all resources. | +| `name` | string | `defaultVersion` | | The name of the application type version | +| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | +| `tags` | object | `{object}` | | Optional. Tags of the resource. | + +### Parameter Usage: `` + +// TODO: Fill in Parameter usage + +### Parameter Usage: `tags` + +Tag names and tag values can be provided as needed. A tag can be left without a value. + +```json +"tags": { + "value": { + "Environment": "Non-Prod", + "Contact": "test.user@testcompany.com", + "PurchaseOrder": "1234", + "CostCenter": "7890", + "ServiceName": "DeploymentValidation", + "Role": "DeploymentValidation" + } +} +``` + +## Outputs + +| Output Name | Type | Description | +| :-- | :-- | :-- | +| `versionName` | string | The name of the Version. | +| `versionResourceGroup` | string | The resource group of the Version. | +| `versionResourceId` | string | The resource ID of the Version. | + +## Template references + +- [Clusters/Applicationtypes/Versions](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes/versions) diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/readme.md b/arm/Microsoft.ServiceFabric/clusters/applications/readme.md new file mode 100644 index 0000000000..91426729a8 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/applications/readme.md @@ -0,0 +1,58 @@ +# ServiceFabric Clusters Applications `[Microsoft.ServiceFabric/clusters/applications]` + +This module deploys ServiceFabric Clusters Applications. +// TODO: Replace Resource and fill in description + +## Resource Types + +| Resource Type | API Version | +| :-- | :-- | +| `Microsoft.ServiceFabric/clusters/applications` | 2021-06-01 | +| `Microsoft.ServiceFabric/clusters/applications/services` | 2021-06-01 | + +## Parameters + +| Parameter Name | Type | Default Value | Possible Values | Description | +| :-- | :-- | :-- | :-- | :-- | +| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | +| `identity` | object | `{object}` | | Optional. Describes the managed identities for an Azure resource. | +| `location` | string | `[resourceGroup().location]` | | Optional. Location for all resources. | +| `name` | string | `defaultApplication` | | Optional. Application name. | +| `properties` | object | `{object}` | | Optional. The application resource properties. | +| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | +| `services` | _[services](services/readme.md)_ array | `[]` | | Optional. List of Services to be created in the Application. | +| `tags` | object | `{object}` | | Optional. Tags of the resource. | + +### Parameter Usage: `` + +// TODO: Fill in Parameter usage + +### Parameter Usage: `tags` + +Tag names and tag values can be provided as needed. A tag can be left without a value. + +```json +"tags": { + "value": { + "Environment": "Non-Prod", + "Contact": "test.user@testcompany.com", + "PurchaseOrder": "1234", + "CostCenter": "7890", + "ServiceName": "DeploymentValidation", + "Role": "DeploymentValidation" + } +} +``` + +## Outputs + +| Output Name | Type | Description | +| :-- | :-- | :-- | +| `applicationName` | string | The resource name of the Application. | +| `applicationResourceGroup` | string | The resource group of the Application. | +| `applicationResourceId` | string | The resource ID of the Application. | + +## Template references + +- [Clusters/Applications](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications) +- [Clusters/Applications/Services](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications/services) diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/services/readme.md b/arm/Microsoft.ServiceFabric/clusters/applications/services/readme.md new file mode 100644 index 0000000000..be87405bd3 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/applications/services/readme.md @@ -0,0 +1,55 @@ +# ServiceFabric Clusters Applications Services `[Microsoft.ServiceFabric/clusters/applications/services]` + +This module deploys ServiceFabric Clusters Applications Services. +// TODO: Replace Resource and fill in description + +## Resource Types + +| Resource Type | API Version | +| :-- | :-- | +| `Microsoft.ServiceFabric/clusters/applications/services` | 2021-06-01 | + +## Parameters + +| Parameter Name | Type | Default Value | Possible Values | Description | +| :-- | :-- | :-- | :-- | :-- | +| `applicationName` | string | `defaultApplication` | | Optional. Application name. | +| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | +| `location` | string | `[resourceGroup().location]` | | Optional. Location for all resources. | +| `name` | string | `defaultService` | | Optional. Name of the Service. | +| `properties` | object | `{object}` | | Optional. Properties of the Service. | +| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | +| `tags` | object | `{object}` | | Optional. Tags of the resource. | + +### Parameter Usage: `` + +// TODO: Fill in Parameter usage + +### Parameter Usage: `tags` + +Tag names and tag values can be provided as needed. A tag can be left without a value. + +```json +"tags": { + "value": { + "Environment": "Non-Prod", + "Contact": "test.user@testcompany.com", + "PurchaseOrder": "1234", + "CostCenter": "7890", + "ServiceName": "DeploymentValidation", + "Role": "DeploymentValidation" + } +} +``` + +## Outputs + +| Output Name | Type | Description | +| :-- | :-- | :-- | +| `serviceName` | string | The resource name of the service. | +| `serviceResourceGroup` | string | The resource group of the service. | +| `serviceResourceId` | string | The resource ID of the service. | + +## Template references + +- [Clusters/Applications/Services](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications/services) diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index ab7e32a01f..41710a0025 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -341,15 +341,15 @@ module serviceFabricCluster_applications 'applications/deploy.bicep' = [for appl }] @description('The Service Fabric Cluster name.') -output serviceFabricClusterName string = serviceFabricCluster.name +output clusterName string = serviceFabricCluster.name @description('The Service Fabric Cluster object.') -output serviceFabricCluster object = serviceFabricCluster +output clusterObject object = serviceFabricCluster @description('The Service Fabric Cluster resource group.') -output serviceFabricClusterResourceGroup string = resourceGroup().name +output clusterResourceGroup string = resourceGroup().name @description('The Service Fabric Cluster resource ID.') -output serviceFabricClusterId string = serviceFabricCluster.id +output clusterId string = serviceFabricCluster.id @description('The Service Fabric Cluster endpoint.') output clusterEndpoint string = serviceFabricCluster.properties.clusterEndpoint diff --git a/arm/Microsoft.ServiceFabric/clusters/readme.md b/arm/Microsoft.ServiceFabric/clusters/readme.md index c1b34dc305..c92cdd4e28 100644 --- a/arm/Microsoft.ServiceFabric/clusters/readme.md +++ b/arm/Microsoft.ServiceFabric/clusters/readme.md @@ -4,21 +4,23 @@ This module deploys a service fabric cluster ## Resource Types -| Resource Type | Api Version | +| Resource Type | API Version | | :-- | :-- | | `Microsoft.Authorization/locks` | 2016-09-01 | +| `Microsoft.Authorization/roleAssignments` | 2020-04-01-preview | | `Microsoft.ServiceFabric/clusters` | 2021-06-01 | | `Microsoft.ServiceFabric/clusters/applications` | 2021-06-01 | | `Microsoft.ServiceFabric/clusters/applications/services` | 2021-06-01 | | `Microsoft.ServiceFabric/clusters/applicationTypes` | 2021-06-01 | | `Microsoft.ServiceFabric/clusters/applicationTypes/versions` | 2021-06-01 | -| `Microsoft.ServiceFabric/clusters/providers/roleAssignments` | 2020-04-01-preview | ## Parameters | Parameter Name | Type | Default Value | Possible Values | Description | | :-- | :-- | :-- | :-- | :-- | | `addOnFeatures` | array | `[]` | `[BackupRestoreService, DnsService, RepairManager, ResourceMonitorService]` | Optional. The list of add-on features to enable in the cluster. | +| `applications` | _[applications](applications/readme.md)_ array | `[]` | | Optional. Array of Service Fabric cluster applications. | +| `applicationTypes` | _[applicationTypes](applicationTypes/readme.md)_ array | `[]` | | Optional. Array of Service Fabric cluster application types. | | `azureActiveDirectory` | object | `{object}` | | Optional. Object containing Azure active directory client application id, cluster application id and tenant id. | | `certificate` | object | `{object}` | | Optional. Describes the certificate details like thumbprint of the primary certificate, thumbprint of the secondary certificate and the local certificate store location | | `certificateCommonNames` | object | `{object}` | | Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster. | @@ -34,15 +36,13 @@ This module deploys a service fabric cluster | `lock` | string | `NotSpecified` | `[CanNotDelete, NotSpecified, ReadOnly]` | Optional. Specify the type of lock. | | `managementEndpoint` | string | | | Required. The http management endpoint of the cluster. | | `maxUnusedVersionsToKeep` | int | `3` | | Required. Number of unused versions per application type to keep. | +| `name` | string | | | Required. Name of the Serivce Fabric cluster. | | `nodeTypes` | array | `[]` | | Required. The list of node types in the cluster. | | `notifications` | array | `[]` | | Optional. Indicates a list of notification channels for cluster events. | | `reliabilityLevel` | string | `None` | `[Bronze, Gold, None, Platinum, Silver]` | Optional. The reliability level sets the replica set size of system services. Learn about ReliabilityLevel (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-capacity). - None - Run the System services with a target replica set count of 1. This should only be used for test clusters. - Bronze - Run the System services with a target replica set count of 3. This should only be used for test clusters. - Silver - Run the System services with a target replica set count of 5. - Gold - Run the System services with a target replica set count of 7. - Platinum - Run the System services with a target replica set count of 9. | | `reverseProxyCertificate` | object | `{object}` | | Optional. Describes the certificate details. | | `reverseProxyCertificateCommonNames` | object | `{object}` | | Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster. | | `roleAssignments` | array | `[]` | | Optional. Array of role assignment objects that contain the 'roleDefinitionIdOrName' and 'principalId' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or it's fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11' | -| `serviceFabricApplicationTypes` | array | `[]` | | Optional. Array of Service Fabric cluster application types. | -| `serviceFabricClusterApplications` | array | `[]` | | Optional. Array of Service Fabric cluster applications. | -| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | | `sfZonalUpgradeMode` | string | `Hierarchical` | `[Hierarchical, Parallel]` | Optional. This property controls the logical grouping of VMs in upgrade domains (UDs). This property cannot be modified if a node type with multiple Availability Zones is already present in the cluster. | | `tags` | object | `{object}` | | Optional. Tags of the resource. | | `upgradeDescription` | object | `{object}` | | Optional. Describes the policy used when upgrading the cluster. | @@ -60,13 +60,6 @@ This module deploys a service fabric cluster ```json "roleAssignments": { "value": [ - { - "roleDefinitionIdOrName": "Storage File Data SMB Share Contributor", - "principalIds": [ - "12345678-1234-1234-1234-123456789012", // object 1 - "78945612-1234-1234-1234-123456789012" // object 2 - ] - }, { "roleDefinitionIdOrName": "Reader", "principalIds": [ @@ -84,17 +77,37 @@ This module deploys a service fabric cluster } ``` +### Parameter Usage: `tags` + +Tag names and tag values can be provided as needed. A tag can be left without a value. + +```json +"tags": { + "value": { + "Environment": "Non-Prod", + "Contact": "test.user@testcompany.com", + "PurchaseOrder": "1234", + "CostCenter": "7890", + "ServiceName": "DeploymentValidation", + "Role": "DeploymentValidation" + } +} +``` + ## Outputs -| Output Name | Type | -| :-- | :-- | -| `serviceFabricClusterName` | string | -| `serviceFabricClusterResourceGroup` | string | -| `serviceFabricClusterResourceId` | string | +| Output Name | Type | Description | +| :-- | :-- | :-- | +| `clusterEndpoint` | string | The Service Fabric Cluster endpoint. | +| `clusterId` | string | The Service Fabric Cluster resource ID. | +| `clusterName` | string | The Service Fabric Cluster name. | +| `clusterObject` | object | The Service Fabric Cluster object. | +| `clusterResourceGroup` | string | The Service Fabric Cluster resource group. | ## Template references - [Locks](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2016-09-01/locks) +- [Roleassignments](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-04-01-preview/roleAssignments) - [Clusters](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters) - [Clusters/Applications](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications) - [Clusters/Applications/Services](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications/services) From cc922c1689c22417443f6a752740026204bb5c34 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Fri, 3 Dec 2021 16:44:42 +0530 Subject: [PATCH 25/50] Add linter suggestions. --- arm/Microsoft.ServiceFabric/clusters/deploy.bicep | 2 +- arm/Microsoft.ServiceFabric/clusters/readme.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 41710a0025..20afb5615e 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -1,4 +1,4 @@ -@description('Required. Name of the Serivce Fabric cluster.') +@description('Required. Name of the Service Fabric cluster.') param name string = '' @description('Optional. Location for all resources.') diff --git a/arm/Microsoft.ServiceFabric/clusters/readme.md b/arm/Microsoft.ServiceFabric/clusters/readme.md index c92cdd4e28..3bad5a370b 100644 --- a/arm/Microsoft.ServiceFabric/clusters/readme.md +++ b/arm/Microsoft.ServiceFabric/clusters/readme.md @@ -21,13 +21,13 @@ This module deploys a service fabric cluster | `addOnFeatures` | array | `[]` | `[BackupRestoreService, DnsService, RepairManager, ResourceMonitorService]` | Optional. The list of add-on features to enable in the cluster. | | `applications` | _[applications](applications/readme.md)_ array | `[]` | | Optional. Array of Service Fabric cluster applications. | | `applicationTypes` | _[applicationTypes](applicationTypes/readme.md)_ array | `[]` | | Optional. Array of Service Fabric cluster application types. | -| `azureActiveDirectory` | object | `{object}` | | Optional. Object containing Azure active directory client application id, cluster application id and tenant id. | +| `azureActiveDirectory` | object | `{object}` | | Optional. Object containing Azure active directory client application ID, cluster application ID and tenant ID. | | `certificate` | object | `{object}` | | Optional. Describes the certificate details like thumbprint of the primary certificate, thumbprint of the secondary certificate and the local certificate store location | | `certificateCommonNames` | object | `{object}` | | Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster. | | `clientCertificateCommonNames` | array | `[]` | | Optional. The list of client certificates referenced by common name that are allowed to manage the cluster. | | `clientCertificateThumbprints` | array | `[]` | | Optional. The list of client certificates referenced by thumbprint that are allowed to manage the cluster. | | `clusterCodeVersion` | string | | | Optional. The Service Fabric runtime version of the cluster. This property can only by set the user when upgradeMode is set to "Manual". To get list of available Service Fabric versions for new clusters use ClusterVersion API. To get the list of available version for existing clusters use availableClusterVersions. | -| `cuaId` | string | | | Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered | +| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | | `diagnosticsStorageAccountConfig` | object | `{object}` | | Optional. The storage account information for storing Service Fabric diagnostic logs. | | `eventStoreServiceEnabled` | bool | | | Optional. Indicates if the event store service is enabled. | | `fabricSettings` | array | `[]` | | Optional. The list of custom fabric settings to configure the cluster. | @@ -36,7 +36,7 @@ This module deploys a service fabric cluster | `lock` | string | `NotSpecified` | `[CanNotDelete, NotSpecified, ReadOnly]` | Optional. Specify the type of lock. | | `managementEndpoint` | string | | | Required. The http management endpoint of the cluster. | | `maxUnusedVersionsToKeep` | int | `3` | | Required. Number of unused versions per application type to keep. | -| `name` | string | | | Required. Name of the Serivce Fabric cluster. | +| `name` | string | | | Required. Name of the Service Fabric cluster. | | `nodeTypes` | array | `[]` | | Required. The list of node types in the cluster. | | `notifications` | array | `[]` | | Optional. Indicates a list of notification channels for cluster events. | | `reliabilityLevel` | string | `None` | `[Bronze, Gold, None, Platinum, Silver]` | Optional. The reliability level sets the replica set size of system services. Learn about ReliabilityLevel (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-capacity). - None - Run the System services with a target replica set count of 1. This should only be used for test clusters. - Bronze - Run the System services with a target replica set count of 3. This should only be used for test clusters. - Silver - Run the System services with a target replica set count of 5. - Gold - Run the System services with a target replica set count of 7. - Platinum - Run the System services with a target replica set count of 9. | From 828da6495c75560a24b443c71fb5639c1571e6cb Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Fri, 3 Dec 2021 16:57:43 +0530 Subject: [PATCH 26/50] Add linter suggestions to deploy.bicep file. --- arm/Microsoft.ServiceFabric/clusters/deploy.bicep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 20afb5615e..258077b9ce 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -15,7 +15,7 @@ param tags object = {} @description('Optional. Specify the type of lock.') param lock string = 'NotSpecified' -@description('Optional. Customer Usage Attribution id (GUID). This GUID must be previously registered') +@description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered') param cuaId string = '' @allowed([ @@ -30,7 +30,7 @@ param addOnFeatures array = [] @description('Required. Number of unused versions per application type to keep.') param maxUnusedVersionsToKeep int = 3 -@description('Optional. Object containing Azure active directory client application id, cluster application id and tenant id.') +@description('Optional. Object containing Azure active directory client application ID, cluster application ID and tenant ID.') param azureActiveDirectory object = {} @description('Optional. Describes the certificate details like thumbprint of the primary certificate, thumbprint of the secondary certificate and the local certificate store location') From 98ad47afba13fe316ea89b1183394cab72c38ca6 Mon Sep 17 00:00:00 2001 From: Kavish Shivhare Date: Tue, 7 Dec 2021 18:25:25 +0530 Subject: [PATCH 27/50] Resolve PR comments. --- .../workflows/ms.servicefabric.clusters.yml | 116 +++++++----------- .../clusters/applicationTypes/deploy.bicep | 2 +- .../clusters/applications/deploy.bicep | 36 +++--- .../applications/services/deploy.bicep | 36 +++--- .../clusters/deploy.bicep | 99 +++++++-------- 5 files changed, 128 insertions(+), 161 deletions(-) diff --git a/.github/workflows/ms.servicefabric.clusters.yml b/.github/workflows/ms.servicefabric.clusters.yml index 70a378740a..13d6f14b04 100644 --- a/.github/workflows/ms.servicefabric.clusters.yml +++ b/.github/workflows/ms.servicefabric.clusters.yml @@ -4,15 +4,21 @@ on: workflow_dispatch: inputs: removeDeployment: + type: boolean description: 'Remove deployed module' required: false default: 'true' versioningOption: - description: 'The mode to handle the version increments [major|minor|patch|custom]' + type: choice + description: 'The mode to handle the version increments [major|minor|patch]' required: false default: 'patch' + options: + - major + - minor + - patch customVersion: - description: 'The version to enforce if [versionOption] is set to [custom]' + description: 'Custom version to apply. Used only if higher than latest' required: false default: '0.0.1' push: @@ -22,15 +28,16 @@ on: - '.github/actions/templates/**' - '.github/workflows/ms.servicefabric.clusters.yml' - 'arm/Microsoft.ServiceFabric/clusters/**' - - '!arm/Microsoft.ServiceFabric/clusters/readme.md' + - '!*/**/readme.md' env: - moduleName: 'clusters' modulePath: 'arm/Microsoft.ServiceFabric/clusters' workflowPath: '.github/workflows/ms.servicefabric.clusters.yml' AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} - ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} - ARM_MGMTGROUP_ID: ${{ secrets.ARM_MGMTGROUP_ID }} + ARM_SUBSCRIPTION_ID: '${{ secrets.ARM_SUBSCRIPTION_ID }}' + ARM_MGMTGROUP_ID: '${{ secrets.ARM_MGMTGROUP_ID }}' + ARM_TENANT_ID: '${{ secrets.ARM_TENANT_ID }}' + DEPLOYMENT_SP_ID: '${{ secrets.DEPLOYMENT_SP_ID }}' jobs: ############################ @@ -71,7 +78,6 @@ jobs: uses: ./.github/actions/templates/validateModuleGeneral with: modulePath: '${{ env.modulePath }}' - moduleName: '${{ env.moduleName}}' # Global API tests # ---------------- @@ -87,17 +93,21 @@ jobs: uses: ./.github/actions/templates/validateModuleApis with: modulePath: '${{ env.modulePath }}' - moduleName: '${{ env.moduleName}}' - # Validate deployment module tests - # -------------------------------- - job_tests_module_deploy_validate: + ########################### + # Deployment module tests # + ########################### + job_module_deploy_validation: runs-on: ubuntu-20.04 name: 'Run deployment validation module tests' + needs: + - job_set_workflow_param + - job_tests_module_global + - job_tests_module_global_api strategy: fail-fast: false matrix: - parameterFilePaths: ['parameters.json'] + parameterFilePaths: ['min.parameters.json', 'parameters.json'] steps: - name: 'Checkout' uses: actions/checkout@v2 @@ -108,47 +118,27 @@ jobs: with: # Name of variable file variableFileName: 'variables.module' # Don't write .json here - - name: 'Test module' + # ----------- # + ## Dry Run ## + # ----------- # + - name: 'Test module with parameter file [${{ matrix.parameterFilePaths }}]' uses: ./.github/actions/templates/validateModuleDeploy with: templateFilePath: '${{ env.modulePath }}/deploy.bicep' - parameterFilePath: '${{ env.modulePath }}/parameters/${{ matrix.parameterFilePaths }}' + parameterFilePath: '${{ env.modulePath }}/.parameters/${{ matrix.parameterFilePaths }}' location: '${{ env.defaultLocation }}' resourceGroupName: '${{ env.resourceGroupName }}' subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' - - #################### - # DEPLOY TESTS # - #################### - job_deploy_module: - runs-on: ubuntu-20.04 - name: 'Deploy module' - needs: - - job_set_workflow_param - - job_tests_module_global - - job_tests_module_global_api - - job_tests_module_deploy_validate - strategy: - fail-fast: false - matrix: - parameterFilePaths: ['parameters.json'] - steps: - - name: 'Checkout' - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set environment variables - uses: deep-mm/set-variables@v1.0 - with: - # Name of variable file - variableFileName: 'variables.module' # Don't write .json here - - name: 'Deploy module' + # ------------------- # + ## Deploy & Remove ## + # ------------------- # + - name: 'Deploy module with parameter file [${{ matrix.parameterFilePaths }}]' + id: step_deploy uses: ./.github/actions/templates/deployModule with: - moduleName: '${{ env.moduleName }}' templateFilePath: '${{ env.modulePath }}/deploy.bicep' - parameterFilePath: '${{ env.modulePath }}/parameters/${{ matrix.parameterFilePaths }}' + parameterFilePath: '${{ env.modulePath }}/.parameters/${{ matrix.parameterFilePaths }}' location: '${{ env.defaultLocation }}' resourceGroupName: '${{ env.resourceGroupName }}' subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' @@ -164,7 +154,7 @@ jobs: runs-on: ubuntu-20.04 needs: - job_set_workflow_param - - job_deploy_module + - job_module_deploy_validation steps: - name: 'Checkout' uses: actions/checkout@v2 @@ -179,36 +169,12 @@ jobs: uses: ./.github/actions/templates/publishModule with: templateFilePath: '${{ env.modulePath }}/deploy.bicep' - componentTemplateSpecRGName: '${{ env.componentTemplateSpecRGName }}' - componentTemplateSpecRGLocation: '${{ env.componentTemplateSpecRGLocation }}' - componentTemplateSpecName: '${{ env.moduleName }}' - componentTemplateSpecDescription: '${{ env.componentTemplateSpecDescription }}' - publishToTemplateSpec: '${{ env.publishToTemplateSpec }}' versioningOption: '${{ needs.job_set_workflow_param.outputs.versioningOption }}' customVersion: '${{ needs.job_set_workflow_param.outputs.customVersion }}' - - ############## - # REMOVE # - ############## - job_remove_module: - runs-on: ubuntu-20.04 - name: 'Remove module' - if: ${{ always() && !cancelled() && needs.job_set_workflow_param.outputs.removeDeployment == 'true' && (contains(needs.*.result, 'success') || contains(needs.*.result, 'failure')) }} - needs: - - job_deploy_module - steps: - - name: 'Checkout' - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set environment variables - uses: deep-mm/set-variables@v1.0 - with: - # Name of variable file - variableFileName: 'variables.module' # Don't write .json here - - name: 'Remove module' - uses: ./.github/actions/templates/removeModule - with: - moduleName: '${{ env.moduleName }}' - templateFilePath: '${{ env.modulePath }}/deploy.bicep' - resourceGroupName: '${{ env.resourceGroupName }}' + templateSpecsRGName: '${{ env.templateSpecsRGName }}' + templateSpecsRGLocation: '${{ env.templateSpecsRGLocation }}' + templateSpecsDescription: '${{ env.templateSpecsDescription }}' + templateSpecsDoPublish: '${{ env.templateSpecsDoPublish }}' + bicepRegistryName: '${{ env.bicepRegistryName }}' + bicepRegistryRGName: '${{ env.bicepRegistryRGName }}' + bicepRegistryDoPublish: '${{ env.bicepRegistryDoPublish }}' diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep index 24be21dcf8..384ba6f144 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep @@ -33,7 +33,7 @@ resource applicationTypes 'Microsoft.ServiceFabric/clusters/applicationTypes@202 parent: serviceFabricCluster location: location tags: tags - properties: !empty(properties) ? properties : null + properties: !empty(properties) ? properties : {} } module applicationTypes_versions 'versions/deploy.bicep' = [for (version, index) in versions: { diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep index 83bcb7c3f7..809c50a481 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep @@ -23,8 +23,8 @@ param properties object = {} param cuaId string = '' var identity_var = { - type: !empty(identity) ? identity.type : 'None' - userAssignedIdentities: !empty(identity) ? identity.userAssignedIdentities : null + type: contains(identity, 'type') ? identity.type : 'None' + userAssignedIdentities: contains(identity, 'userAssignedIdentities') ? identity.userAssignedIdentities : {} } var propertiesManagedIdentities_var = [for managedIdentity in properties.managedIdentities: { @@ -34,7 +34,7 @@ var propertiesManagedIdentities_var = [for managedIdentity in properties.managed var propertiesMetrics_var = [for metric in properties.metrics: { maximumCapacity: contains(metric, 'maximumCapacity') ? metric.maximumCapacity : 0 - name: !empty(metric.name) ? metric.name : null + name: contains(metric, 'name') ? metric.name : null reservationCapacity: contains(metric, 'reservationCapacity') ? metric.reservationCapacity : 0 totalApplicationCapacity: contains(metric, 'totalApplicationCapacity') ? metric.totalApplicationCapacity : 1 }] @@ -48,20 +48,20 @@ var upgradePolicy_var = { maxPercentUnhealthyServices: contains(properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyServices') ? properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyServices : 0 } maxPercentUnhealthyDeployedApplications: contains(properties.upgradePolicy.applicationHealthPolicy, 'maxPercentUnhealthyDeployedApplications') ? properties.upgradePolicy.applicationHealthPolicy.maxPercentUnhealthyDeployedApplications : 0 - serviceTypeHealthPolicyMap: !empty(properties.upgradePolicy.applicationHealthPolicy.serviceTypeHealthPolicyMap) ? properties.upgradePolicy.applicationHealthPolicy.serviceTypeHealthPolicyMap : null + serviceTypeHealthPolicyMap: contains(properties.upgradePolicy.applicationHealthPolicy, 'serviceTypeHealthPolicyMap') ? properties.upgradePolicy.applicationHealthPolicy.serviceTypeHealthPolicyMap : {} } forceRestart: contains(properties.upgradePolicy, 'forceRestart') ? properties.upgradePolicy.forceRestart : false recreateApplication: contains(properties.upgradePolicy, 'recreateApplication') ? properties.upgradePolicy.recreateApplication : false rollingUpgradeMonitoringPolicy: { - failureAction: !empty(properties.upgradePolicy.rollingUpgradeMonitoringPolicy.failureAction) ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.failureAction : 'Manual' - healthCheckRetryTimeout: !empty(properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckRetryTimeout) ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckRetryTimeout : null - healthCheckStableDuration: !empty(properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckStableDuration) ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckStableDuration : null - healthCheckWaitDuration: !empty(properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckWaitDuration) ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckWaitDuration : null - upgradeDomainTimeout: !empty(properties.upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeDomainTimeout) ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeDomainTimeout : null - upgradeTimeout: !empty(properties.upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeTimeout) ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeTimeout : null + failureAction: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'failureAction') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.failureAction : 'Manual' + healthCheckRetryTimeout: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckRetryTimeout') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckRetryTimeout : null + healthCheckStableDuration: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckStableDuration') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckStableDuration : null + healthCheckWaitDuration: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckWaitDuration') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckWaitDuration : null + upgradeDomainTimeout: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeDomainTimeout') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeDomainTimeout : null + upgradeTimeout: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeTimeout') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeTimeout : null } - upgradeMode: !empty(properties.upgradePolicy.upgradeMode) ? properties.upgradePolicy.upgradeMode : 'Invalid' - upgradeReplicaSetCheckTimeout: !empty(properties.upgradePolicy.upgradeReplicaSetCheckTimeout) ? properties.upgradePolicy.upgradeReplicaSetCheckTimeout : null + upgradeMode: contains(properties.upgradePolicy, 'upgradeMode') ? properties.upgradePolicy.upgradeMode : 'Invalid' + upgradeReplicaSetCheckTimeout: contains(properties.upgradePolicy, 'upgradeReplicaSetCheckTimeout') ? properties.upgradePolicy.upgradeReplicaSetCheckTimeout : null } module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { @@ -80,15 +80,15 @@ resource applications 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' tags: tags identity: !empty(identity) ? identity_var : null properties: { - managedIdentities: !empty(properties.managedIdentities) ? propertiesManagedIdentities_var : null + managedIdentities: contains(properties, 'managedIdentities') ? propertiesManagedIdentities_var : [] maximumNodes: contains(properties, 'maximumNodes') ? properties.maximumNodes : 0 - metrics: !empty(properties.metrics) ? propertiesMetrics_var : null + metrics: contains(properties, 'metrics') ? propertiesMetrics_var : [] minimumNodes: contains(properties, 'minimumNodes') ? properties.minimumNodes : 0 - parameters: !empty(properties.parameters) ? properties.parameters : null + parameters: contains(properties, 'parameters') ? properties.parameters : {} removeApplicationCapacity: contains(properties, 'removeApplicationCapacity') ? properties.removeApplicationCapacity : false - typeName: !empty(properties.typeName) ? properties.typeName : null - typeVersion: !empty(properties.typeVersion) ? properties.typeVersion : null - upgradePolicy: !empty(properties.upgradePolicy) ? upgradePolicy_var : null + typeName: contains(properties, 'typeName') ? properties.typeName : null + typeVersion: contains(properties, 'typeVersion') ? properties.typeVersion : null + upgradePolicy: contains(properties, 'upgradePolicy') ? upgradePolicy_var : {} } } diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep index 455e189873..d0e7e46887 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep @@ -20,38 +20,38 @@ param tags object = {} param cuaId string = '' var correlationScheme_var = [for correlationScheme in items(properties.value.correlationScheme): { - scheme: !empty(correlationScheme.value.scheme) ? '${correlationScheme.value.scheme}' : null - serviceName: !empty(correlationScheme.value.serviceName) ? '${correlationScheme.value.serviceName}' : null + scheme: contains(correlationScheme.key, 'scheme') ? correlationScheme.value.scheme : null + serviceName: contains(correlationScheme.key, 'serviceName') ? correlationScheme.value.serviceName : null }] var serviceLoadMetrics_var = [for serviceLoadMetric in items(properties.value.serviceLoadMetrics): { defaultLoad: contains(serviceLoadMetric, 'defaultLoad') ? serviceLoadMetric.value.defaultLoad : 1 - name: !empty(serviceLoadMetric.value.name) ? '${serviceLoadMetric.value.name}' : null + name: contains(serviceLoadMetric.value, 'name') ? serviceLoadMetric.value.name : null primaryDefaultLoad: contains(serviceLoadMetric, 'primaryDefaultLoad') ? serviceLoadMetric.value.primaryDefaultLoad : 1 secondaryDefaultLoad: contains(serviceLoadMetric, 'secondaryDefaultLoad') ? serviceLoadMetric.value.secondaryDefaultLoad : 1 - weight: !empty(serviceLoadMetric.value.weight) ? '${serviceLoadMetric.value.weight}' : null + weight: contains(serviceLoadMetric.value, 'weight') ? serviceLoadMetric.value.weight : null }] var properties_var = { - correlationScheme: !empty(correlationScheme_var) ? correlationScheme_var : [] - defaultMoveCost: !empty(properties.defaultMoveCost) ? '${properties.defaultMoveCost}' : null + correlationScheme: contains(properties, 'correlationScheme') ? correlationScheme_var : [] + defaultMoveCost: contains(properties, 'defaultMoveCost') ? properties.defaultMoveCost : null partitionDescription: { - partitionScheme: !empty(properties.partitionDescription.partitionScheme) ? '${properties.partitionDescription.partitionScheme}' : null + partitionScheme: contains(properties.partitionDescription, 'partitionScheme') ? properties.partitionDescription.partitionScheme : null count: contains(properties.partitionDescription, 'count') ? properties.partitionDescription.count : 1 - names: !empty(properties.partitionDescription.names) ? properties.partitionDescription.names : [] + names: contains(properties.partitionDescription, 'names') ? properties.partitionDescription.names : [] } - placementConstraints: !empty(properties.placementConstraints) ? '${properties.placementConstraints}' : null - serviceDnsName: !empty(properties.serviceDnsName) ? '${properties.serviceDnsName}' : null - serviceLoadMetrics: !empty(properties.serviceLoadMetrics) ? serviceLoadMetrics_var : [] - servicePackageActivationMode: !empty(properties.servicePackageActivationMode) ? '${properties.servicePackageActivationMode}' : null - servicePlacementPolicies: !empty(properties.servicePlacementPolicies) ? properties.servicePlacementPolicies : [] - serviceTypeName: !empty(properties.serviceTypeName) ? '${properties.serviceTypeName}' : null - serviceKind: !empty(properties.serviceKind) ? '${properties.serviceKind}' : null + placementConstraints: contains(properties, 'placementConstraints') ? properties.placementConstraints : null + serviceDnsName: contains(properties, 'serviceDnsName') ? properties.serviceDnsName : null + serviceLoadMetrics: contains(properties, 'serviceLoadMetrics') ? serviceLoadMetrics_var : [] + servicePackageActivationMode: contains(properties, 'servicePackageActivationMode') ? properties.servicePackageActivationMode : null + servicePlacementPolicies: contains(properties, 'servicePlacementPolicies') ? properties.servicePlacementPolicies : [] + serviceTypeName: contains(properties, 'serviceTypeName') ? properties.serviceTypeName : null + serviceKind: contains(properties, 'serviceKind') ? properties.serviceKind : null hasPersistedState: contains(properties, 'hasPersistedState') ? properties.hasPersistedState : true minReplicaSetSize: contains(properties, 'minReplicaSetSize') ? properties.minReplicaSetSize : 1 - quorumLossWaitDuration: !empty(properties.quorumLossWaitDuration) ? '${properties.quorumLossWaitDuration}' : null - replicaRestartWaitDuration: !empty(properties.replicaRestartWaitDuration) ? '${properties.replicaRestartWaitDuration}' : null - standByReplicaKeepDuration: !empty(properties.standByReplicaKeepDuration) ? '${properties.standByReplicaKeepDuration}' : null + quorumLossWaitDuration: contains(properties, 'quorumLossWaitDuration') ? properties.quorumLossWaitDuration : null + replicaRestartWaitDuration: contains(properties, 'replicaRestartWaitDuration') ? properties.replicaRestartWaitDuration : null + standByReplicaKeepDuration: contains(properties, 'standByReplicaKeepDuration') ? properties.standByReplicaKeepDuration : null targetReplicaSetSize: contains(properties, 'targetReplicaSetSize') ? properties.targetReplicaSetSize : 1 } diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 258077b9ce..cb2fa51746 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -77,7 +77,7 @@ param notifications array = [] 'Silver' ]) @description('Optional. The reliability level sets the replica set size of system services. Learn about ReliabilityLevel (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-capacity). - None - Run the System services with a target replica set count of 1. This should only be used for test clusters. - Bronze - Run the System services with a target replica set count of 3. This should only be used for test clusters. - Silver - Run the System services with a target replica set count of 5. - Gold - Run the System services with a target replica set count of 7. - Platinum - Run the System services with a target replica set count of 9.') -param reliabilityLevel string = 'None' +param reliabilityLevel string @description('Optional. Describes the certificate details.') param reverseProxyCertificate object = {} @@ -139,49 +139,49 @@ param applications array = [] param applicationTypes array = [] var azureActiveDirectory_var = { - clientApplication: !empty(azureActiveDirectory) ? azureActiveDirectory.clientApplication : null - clusterApplication: !empty(azureActiveDirectory) ? azureActiveDirectory.clusterApplication : null - tenantId: !empty(azureActiveDirectory) ? azureActiveDirectory.tenantId : null + clientApplication: contains(azureActiveDirectory, 'clientApplication') ? azureActiveDirectory.clientApplication : null + clusterApplication: contains(azureActiveDirectory, 'clusterApplication') ? azureActiveDirectory.clusterApplication : null + tenantId: contains(azureActiveDirectory, 'tenantId') ? azureActiveDirectory.tenantId : null } var certificate_var = { - thumbprint: !empty(certificate) ? certificate.thumbprint : null - //thumbprintSecondary: !empty(certificate) ? certificate.thumbprintSecondary : null - x509StoreName: !empty(certificate) ? certificate.x509StoreName : null + thumbprint: contains(certificate, 'thumbprint') ? certificate.thumbprint : null + thumbprintSecondary: contains(certificate, 'thumbprintSecondary') ? certificate.thumbprintSecondary : null + x509StoreName: contains(certificate, 'x509StoreName') ? certificate.x509StoreName : null } var certificateCommonNamesList_var = [for certificateCommonName in items(certificateCommonNames): { - commonNames: !empty(certificateCommonName.value.commonNames) ? certificateCommonName.value.commonNames : [] + commonNames: contains(certificateCommonName.key, 'commonNames') ? certificateCommonName.value.commonNames : [] }] var certificateCommonNames_var = { - commonNames: !empty(certificateCommonNames) ? certificateCommonNamesList_var : null - x509StoreName: !empty(certificateCommonNames) ? certificateCommonNames.x509StoreName : null + commonNames: contains(certificateCommonNames, 'commonNames') ? certificateCommonNamesList_var : null + x509StoreName: contains(certificateCommonNames, 'x509StoreName') ? certificateCommonNames.x509StoreName : null } var clientCertificateCommonNames_var = [for clientCertificateCommonName in clientCertificateCommonNames: { - certificateCommonName: !empty(clientCertificateCommonName.certificateCommonName) ? '${clientCertificateCommonName.certificateCommonName}' : null - certificateIssuerThumbprint: !empty(clientCertificateCommonName.certificateIssuerThumbprint) ? '${clientCertificateCommonName.certificateIssuerThumbprint}' : null + certificateCommonName: contains(clientCertificateCommonName, 'certificateCommonName') ? clientCertificateCommonName.certificateCommonName : null + certificateIssuerThumbprint: contains(clientCertificateCommonName, 'certificateIssuerThumbprint') ? clientCertificateCommonName.certificateIssuerThumbprint : null isAdmin: contains(clientCertificateCommonName, 'isAdmin') ? clientCertificateCommonName.isAdmin : false }] var clientCertificateThumbprints_var = [for clientCertificateThumbprint in clientCertificateThumbprints: { - certificateThumbprint: !empty(clientCertificateThumbprint.certificateThumbprint) ? '${clientCertificateThumbprint.certificateThumbprint}' : null + certificateThumbprint: contains(clientCertificateThumbprint, 'certificateThumbprint') ? clientCertificateThumbprint.certificateThumbprint : null isAdmin: contains(clientCertificateThumbprint, 'isAdmin') ? clientCertificateThumbprint.isAdmin : false }] var diagnosticsStorageAccountConfig_var = { - blobEndpoint: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.blobEndpoint : null - protectedAccountKeyName: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.protectedAccountKeyName : null - protectedAccountKeyName2: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.protectedAccountKeyName2 : null - queueEndpoint: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.queueEndpoint : null - storageAccountName: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.storageAccountName : null - tableEndpoint: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig.tableEndpoint : null + blobEndpoint: contains(diagnosticsStorageAccountConfig, 'blobEndpoint') ? diagnosticsStorageAccountConfig.blobEndpoint : null + protectedAccountKeyName: contains(diagnosticsStorageAccountConfig, 'protectedAccountKeyName') ? diagnosticsStorageAccountConfig.protectedAccountKeyName : null + protectedAccountKeyName2: contains(diagnosticsStorageAccountConfig, 'protectedAccountKeyName2') ? diagnosticsStorageAccountConfig.protectedAccountKeyName2 : null + queueEndpoint: contains(diagnosticsStorageAccountConfig, 'queueEndpoint') ? diagnosticsStorageAccountConfig.queueEndpoint : null + storageAccountName: contains(diagnosticsStorageAccountConfig, 'storageAccountName') ? diagnosticsStorageAccountConfig.storageAccountName : null + tableEndpoint: contains(diagnosticsStorageAccountConfig, 'tableEndpoint') ? diagnosticsStorageAccountConfig.tableEndpoint : null } var fabricSettings_var = [for fabricSetting in fabricSettings: { - name: !empty(fabricSetting.name) ? fabricSetting.name : null - parameters: !empty(fabricSetting.parameters) ? fabricSetting.parameters : null + name: contains(fabricSetting, 'name') ? fabricSetting.name : null + parameters: contains(fabricSetting, 'parameters') ? fabricSetting.parameters : null }] var nodeTypes_var = [for nodeType in nodeTypes: { @@ -200,7 +200,7 @@ var nodeTypes_var = [for nodeType in nodeTypes: { isPrimary: contains(nodeType, 'isPrimary') ? nodeType.isPrimary : null isStateless: contains(nodeType, 'isStateless') ? nodeType.isStateless : null multipleAvailabilityZones: contains(nodeType, 'multipleAvailabilityZones') ? nodeType.multipleAvailabilityZones : null - name: '${(!empty(nodeType.name) ? nodeType.name : 'Node00')}' + name: !empty(nodeType.name) ? nodeType.name : 'Node00' placementProperties: contains(nodeType, 'placementProperties') ? nodeType.placementProperties : null reverseProxyEndpointPort: contains(nodeType, 'reverseProxyEndpointPort') ? nodeType.reverseProxyEndpointPort : null vmInstanceCount: contains(nodeType, 'vmInstanceCount') ? nodeType.vmInstanceCount : 1 @@ -208,45 +208,45 @@ var nodeTypes_var = [for nodeType in nodeTypes: { var notifications_var = [for notification in notifications: { isEnabled: contains(notification, 'isEnabled') ? notification.isEnabled : false - notificationCategory: !empty(notification.notificationCategory) ? notification.notificationCategory : 'WaveProgress' - notificationLevel: !empty(notification.notificationLevel) ? notification.notificationLevel : 'All' - notificationTargets: !empty(notification.notificationTargets) ? notification.notificationTargets : [] + notificationCategory: contains(notification, 'notificationCategory') ? notification.notificationCategory : 'WaveProgress' + notificationLevel: contains(notification, 'notificationLevel') ? notification.notificationLevel : 'All' + notificationTargets: contains(notification, 'notificationTargets') ? notification.notificationTargets : [] }] var reverseProxyCertificate_var = { - thumbprint: !empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprint : null - thumbprintSecondary: !empty(reverseProxyCertificate) ? reverseProxyCertificate.thumbprintSecondary : null - x509StoreName: !empty(reverseProxyCertificate) ? reverseProxyCertificate.x509StoreName : null + thumbprint: contains(reverseProxyCertificate, 'thumbprint') ? reverseProxyCertificate.thumbprint : null + thumbprintSecondary: contains(reverseProxyCertificate, 'thumbprintSecondary') ? reverseProxyCertificate.thumbprintSecondary : null + x509StoreName: contains(reverseProxyCertificate, 'x509StoreName') ? reverseProxyCertificate.x509StoreName : null } var reverseProxyCertificateCommonNamesList_var = [for reverseProxyCertificateCommonName in items(reverseProxyCertificateCommonNames): { - commonNames: reverseProxyCertificateCommonName.value.commonNames + commonNames: contains(reverseProxyCertificateCommonName.key, 'commonNames') ? reverseProxyCertificateCommonName.value.commonNames : [] }] var reverseProxyCertificateCommonNames_var = { - commonNames: !empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNamesList_var : null - x509StoreName: !empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames.x509StoreName : null + commonNames: contains(reverseProxyCertificateCommonNames, 'commonNames') ? reverseProxyCertificateCommonNamesList_var : [] + x509StoreName: contains(reverseProxyCertificateCommonNames, 'x509StoreName') ? reverseProxyCertificateCommonNames.x509StoreName : null } var upgradeDescription_var = { deltaHealthPolicy: { - applicationDeltaHealthPolicies: !empty(upgradeDescription) ? upgradeDescription.applicationDeltaHealthPolicies : null - maxPercentDeltaUnhealthyApplications: !empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyApplications : null - maxPercentDeltaUnhealthyNodes: !empty(upgradeDescription) ? upgradeDescription.maxPercentDeltaUnhealthyNodes : null - maxPercentUpgradeDomainDeltaUnhealthyNodes: !empty(upgradeDescription) ? upgradeDescription.maxPercentUpgradeDomainDeltaUnhealthyNodes : null + applicationDeltaHealthPolicies: contains(upgradeDescription, 'applicationDeltaHealthPolicies') ? upgradeDescription.applicationDeltaHealthPolicies : {} + maxPercentDeltaUnhealthyApplications: contains(upgradeDescription, 'maxPercentDeltaUnhealthyApplications') ? upgradeDescription.maxPercentDeltaUnhealthyApplications : 0 + maxPercentDeltaUnhealthyNodes: contains(upgradeDescription, 'maxPercentDeltaUnhealthyNodes') ? upgradeDescription.maxPercentDeltaUnhealthyNodes : 0 + maxPercentUpgradeDomainDeltaUnhealthyNodes: contains(upgradeDescription, 'maxPercentUpgradeDomainDeltaUnhealthyNodes') ? upgradeDescription.maxPercentUpgradeDomainDeltaUnhealthyNodes : 0 } - forceRestart: !empty(upgradeDescription) ? upgradeDescription.forceRestart : null - healthCheckRetryTimeout: '${!empty(upgradeDescription) ? upgradeDescription.healthCheckRetryTimeout : null}' - healthCheckStableDuration: '${!empty(upgradeDescription) ? upgradeDescription.healthCheckStableDuration : null}' - healthCheckWaitDuration: '${!empty(upgradeDescription) ? upgradeDescription.healthCheckWaitDuration : null}' + forceRestart: contains(upgradeDescription, 'forceRestart') ? upgradeDescription.forceRestart : false + healthCheckRetryTimeout: contains(upgradeDescription, 'healthCheckRetryTimeout') ? upgradeDescription.healthCheckRetryTimeout : '00:30:00' + healthCheckStableDuration: contains(upgradeDescription, 'healthCheckStableDuration') ? upgradeDescription.healthCheckStableDuration : '01:00:00' + healthCheckWaitDuration: contains(upgradeDescription, 'healthCheckWaitDuration') ? upgradeDescription.healthCheckWaitDuration : '00:15:00' healthPolicy: { - applicationHealthPolicies: !empty(upgradeDescription) ? upgradeDescription.healthPolicy.applicationHealthPolicies : null - maxPercentUnhealthyApplications: !empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : null - maxPercentUnhealthyNodes: !empty(upgradeDescription) ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : null - upgradeDomainTimeout: '${!empty(upgradeDescription) ? upgradeDescription.upgradeDomainTimeout : null}' - upgradeReplicaSetCheckTimeout: '${!empty(upgradeDescription) ? upgradeDescription.upgradeReplicaSetCheckTimeout : null}' - upgradeTimeout: '${!empty(upgradeDescription) ? upgradeDescription.upgradeTimeout : null}' + applicationHealthPolicies: contains(upgradeDescription.healthPolicy, 'applicationHealthPolicies') ? upgradeDescription.healthPolicy.applicationHealthPolicies : {} + maxPercentUnhealthyApplications: contains(upgradeDescription.healthPolicy, 'maxPercentUnhealthyApplications') ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : 10 + maxPercentUnhealthyNodes: contains(upgradeDescription.healthPolicy, 'maxPercentUnhealthyNodes') ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : 10 } + upgradeDomainTimeout: contains(upgradeDescription, 'upgradeDomainTimeout') ? upgradeDescription.upgradeDomainTimeout : '01:00:00' + upgradeReplicaSetCheckTimeout: contains(upgradeDescription, 'upgradeReplicaSetCheckTimeout') ? upgradeDescription.upgradeReplicaSetCheckTimeout : '03:00:00' + upgradeTimeout: contains(upgradeDescription, 'upgradeTimeout') ? upgradeDescription.upgradeTimeout : '02:00:00' } module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { @@ -274,10 +274,10 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { eventStoreServiceEnabled: eventStoreServiceEnabled fabricSettings: !empty(fabricSettings) ? fabricSettings_var : null infrastructureServiceManager: infrastructureServiceManager - managementEndpoint: '${!empty(managementEndpoint) ? managementEndpoint : null}' - nodeTypes: nodeTypes_var + managementEndpoint: managementEndpoint + nodeTypes: !empty(nodeTypes) ? nodeTypes_var : [] notifications: !empty(notifications) ? notifications_var : null - reliabilityLevel: reliabilityLevel + reliabilityLevel: !empty(reliabilityLevel) ? reliabilityLevel : 'None' reverseProxyCertificate: !empty(reverseProxyCertificate) ? reverseProxyCertificate_var : null reverseProxyCertificateCommonNames: !empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames_var : null sfZonalUpgradeMode: !empty(sfZonalUpgradeMode) ? sfZonalUpgradeMode : null @@ -342,6 +342,7 @@ module serviceFabricCluster_applications 'applications/deploy.bicep' = [for appl @description('The Service Fabric Cluster name.') output clusterName string = serviceFabricCluster.name + @description('The Service Fabric Cluster object.') output clusterObject object = serviceFabricCluster @@ -349,7 +350,7 @@ output clusterObject object = serviceFabricCluster output clusterResourceGroup string = resourceGroup().name @description('The Service Fabric Cluster resource ID.') -output clusterId string = serviceFabricCluster.id +output clusterResourceId string = serviceFabricCluster.id @description('The Service Fabric Cluster endpoint.') output clusterEndpoint string = serviceFabricCluster.properties.clusterEndpoint From 4f66d1a0647becbfe5ab90c07ae9a1a851a29388 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 10:04:14 +0100 Subject: [PATCH 28/50] Expanded further properties --- .../clusters/.parameters/parameters.json | 243 +++++++++--------- .../clusters/applicationTypes/deploy.bicep | 15 +- .../applicationTypes/versions/deploy.bicep | 4 - .../clusters/applications/deploy.bicep | 119 ++++++--- .../applications/services/deploy.bicep | 136 +++++++--- .../clusters/deploy.bicep | 29 ++- 6 files changed, 324 insertions(+), 222 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index 0f5106890f..d702e9f75a 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -5,20 +5,17 @@ "name": { "value": "sxx-az-sfc-weu-x-001" }, - "location": { - "value": "centralIndia" - }, "tags": { "value": { "resourceType": "Service Fabric", "clusterName": "sxx-az-sfc-weu-x-001" } }, - "lock": { - "value": "CanNotDelete" - }, "addOnFeatures": { - "value": ["DnsService", "RepairManager"] + "value": [ + "DnsService", + "RepairManager" + ] }, "maxUnusedVersionsToKeep": { "value": 2 @@ -75,39 +72,45 @@ // } // }, "fabricSettings": { - "value": [{ - "name": "Security", - "parameters": [{ - "name": "ClusterProtectionLevel", - "value": "EncryptAndSign" - }] - }] + "value": [ + { + "name": "Security", + "parameters": [ + { + "name": "ClusterProtectionLevel", + "value": "EncryptAndSign" + } + ] + } + ] }, "managementEndpoint": { - "value": "https://sxx-az-sfc-weu-x-001.centralindia.cloudapp.azure.com:19080" + "value": "https://sxx-az-sfc-weu-x-001.westeurope.cloudapp.azure.com:19080" }, "nodeTypes": { - "value": [{ - "applicationPorts": { - "endPort": 30000, - "startPort": 20000 - }, - "capacities": {}, - "clientConnectionEndpointPort": 19000, - "durabilityLevel": "Silver", - "ephemeralPorts": { - "endPort": 65534, - "startPort": 49152 - }, - "httpGatewayEndpointPort": 19080, - "isPrimary": true, - "isStateless": false, - "multipleAvailabilityZones": false, - "name": "001Node01", - "placementProperties": {}, - "reverseProxyEndpointPort": "", - "vmInstanceCount": 5 - }] + "value": [ + { + "applicationPorts": { + "endPort": 30000, + "startPort": 20000 + }, + "capacities": {}, + "clientConnectionEndpointPort": 19000, + "durabilityLevel": "Silver", + "ephemeralPorts": { + "endPort": 65534, + "startPort": 49152 + }, + "httpGatewayEndpointPort": 19080, + "isPrimary": true, + "isStateless": false, + "multipleAvailabilityZones": false, + "name": "001Node01", + "placementProperties": {}, + "reverseProxyEndpointPort": "", + "vmInstanceCount": 5 + } + ] }, // "notifications": { // "value": [{ @@ -120,6 +123,9 @@ // }] // }] // }, + // "upgradeDescription": { + // "value": {} + // }, "reliabilityLevel": { "value": "Silver" }, @@ -127,100 +133,91 @@ "value": "Linux" }, "roleAssignments": { - "value": [{ - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "6bffd5f5-80d9-435c-903e-78354538a902" - ] - }] + "value": [ + { + "roleDefinitionIdOrName": "Reader", + "principalIds": [ + "e58511af-4da2-449c-a5cd-6a10271cfb83" + ] + } + ] + }, + "applications": { + "value": [ + { + "name": "serviceFabricClusterApplication01", + "identity": { + "type": "None", + "userAssignedIdentities": {} + }, + "managedIdentities": [ + { + "name": "Identity_Friendly_Name", + "principalId": "e58511af-4da2-449c-a5cd-6a10271cfb83" + } + ], + "maximumNodes": 2, + "metrics": [ + { + "maximumCapacity": null, + "name": null, + "reservationCapacity": null, + "totalApplicationCapacity": null + } + ], + "minimumNodes": null, + "parameters": {}, + "removeApplicationCapacity": "", + "typeName": "DotNetCore", + "typeVersion": "VersionOne", + "upgradePolicy": { + "applicationHealthPolicy": { + "considerWarningAsError": "", + "defaultServiceTypeHealthPolicy": { + "maxPercentUnhealthyPartitionsPerService": null, + "maxPercentUnhealthyReplicasPerPartition": null, + "maxPercentUnhealthyServices": null + }, + "maxPercentUnhealthyDeployedApplications": null, + "serviceTypeHealthPolicyMap": {} + }, + "forceRestart": "", + "recreateApplication": "", + "rollingUpgradeMonitoringPolicy": { + "failureAction": null, + "healthCheckRetryTimeout": null, + "healthCheckStableDuration": null, + "healthCheckWaitDuration": null, + "upgradeDomainTimeout": null, + "upgradeTimeout": null + }, + "upgradeMode": "UnmonitoredAuto", + "upgradeReplicaSetCheckTimeout": null + }, + "services": { + "value": [ + { + "name": "Service01", + "correlationScheme": [ + { + "scheme": "Invalid", + "serviceName": "fabric:service01" + } + ] + } + ] + } + } + ] } //, - // "applications": { - // "value": [ - // { - // "name": "serviceFabricClusterApplication01", - // "identity": { - // "type": "None", - // "userAssignedIdentities": {} - // }, - // "properties": { - // "managedIdentities": [ - // { - // "name": "Identity_Friendly_Name", - // "principalId": "6bffd5f5-80d9-435c-903e-78354538a902" - // } - // ], - // "maximumNodes": 2, - // "metrics": [ - // { - // "maximumCapacity": null, - // "name": null, - // "reservationCapacity": null, - // "totalApplicationCapacity": null - // } - // ], - // "minimumNodes": null, - // "parameters": {}, - // "removeApplicationCapacity": "", - // "typeName": "DotNetCore", - // "typeVersion": "VersionOne", - // "upgradePolicy": { - // "applicationHealthPolicy": { - // "considerWarningAsError": "", - // "defaultServiceTypeHealthPolicy": { - // "maxPercentUnhealthyPartitionsPerService": null, - // "maxPercentUnhealthyReplicasPerPartition": null, - // "maxPercentUnhealthyServices": null - // }, - // "maxPercentUnhealthyDeployedApplications": null, - // "serviceTypeHealthPolicyMap": {} - // }, - // "forceRestart": "", - // "recreateApplication": "", - // "rollingUpgradeMonitoringPolicy": { - // "failureAction": null, - // "healthCheckRetryTimeout": null, - // "healthCheckStableDuration": null, - // "healthCheckWaitDuration": null, - // "upgradeDomainTimeout": null, - // "upgradeTimeout": null - // }, - // "upgradeMode": "UnmonitoredAuto", - // "upgradeReplicaSetCheckTimeout": null - // } - // }, - // "services": { - // "value": [ - // { - // "name": "Service01", - // "properties": { - // "provisioningState": "Default", - // "correlationScheme": [ - // { - // "scheme": "Invalid", - // "serviceName": "fabric:service01" - // } - // ] - // } - // } - // ] - // } - // } - // ] - // }, // "applicationTypes": { // "value": [ // { // "name": "DotNetCore", - // "properties": { - // "provisioningState": "Default" - // }, // "versions": [ // { - // "name": "VersionOne", - // "properties": { - // "provisioningState": "Default", - // "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/blob/master/WordCountV1.sfpkg" - // } + // "name": "VersionTwo", + // "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/raw/master/WordCountV2.sfpkg" // } // ] // } diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep index 384ba6f144..6f1455631b 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep @@ -7,15 +7,9 @@ param name string = 'defaultApplicationType' @description('Optional. Array of Versions to create.') param versions array = [] -@description('Optional. Location for all resources.') -param location string = resourceGroup().location - @description('Optional. Tags of the resource.') param tags object = {} -@description('Optional. The application type name properties.') -param properties object = {} - @description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered') param cuaId string = '' @@ -31,16 +25,17 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' exis resource applicationTypes 'Microsoft.ServiceFabric/clusters/applicationTypes@2021-06-01' = { name: name parent: serviceFabricCluster - location: location tags: tags - properties: !empty(properties) ? properties : {} } module applicationTypes_versions 'versions/deploy.bicep' = [for (version, index) in versions: { name: '${deployment().name}-SFC-Versions-${index}' params: { - appPackageUrl: contains(versions, 'appPackageUrl') ? version.appPackageUrl : null - name: contains(versions, 'applicationTypeVersionName') ? version.applicationTypeVersionName : null + applicationTypeName: name + serviceFabricClusterName: serviceFabricClusterName + tags: contains(versions, 'tags') ? version.tags : {} + appPackageUrl: version.appPackageUrl + name: contains(versions, 'name') ? version.name : 'default' } }] diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep index 7606c126f0..4c45728574 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep @@ -7,9 +7,6 @@ param applicationTypeName string = 'default' @description('The name of the application type version') param name string = 'defaultVersion' -@description('Optional. Location for all resources.') -param location string = resourceGroup().location - @description('Optional. Tags of the resource.') param tags object = {} @@ -35,7 +32,6 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' exis resource versions 'Microsoft.ServiceFabric/clusters/applicationTypes/versions@2021-06-01' = { name: name parent: serviceFabricCluster::applicationTypes - location: location tags: tags properties: { appPackageUrl: appPackageUrl diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep index 809c50a481..4aa4479778 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep @@ -4,9 +4,6 @@ param serviceFabricClusterName string = '' @description('Optional. Application name.') param name string = 'defaultApplication' -@description('Optional. Location for all resources.') -param location string = resourceGroup().location - @description('Optional. List of Services to be created in the Application.') param services array = [] @@ -16,8 +13,32 @@ param tags object = {} @description('Optional. Describes the managed identities for an Azure resource.') param identity object = {} -@description('Optional. The application resource properties.') -param properties object = {} +@description('Optional. List of user assigned identities for the application, each mapped to a friendly name.') +param managedIdentities array = [] + +@description('Optional. The maximum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. By default, the value of this property is zero and it means that the services can be placed on any node.') +param maximumNodes int = 0 + +@description('Optional. The minimum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property.') +param minimumNodes int = 0 + +@description('Optional. List of application capacity metric description.') +param metrics array = [] + +@description('Optional. List of application parameters with overridden values from their default values specified in the application manifest.') +param parameters object = {} + +@description('Optional. Remove the current application capacity settings') +param removeApplicationCapacity bool = false + +@description('Optional. The application type name as defined in the application manifest.') +param typeName string = '' + +@description('Optional. The version of the application type as defined in the application manifest.') +param typeVersion string = '' + +@description('Optional. Describes the policy for a monitored application upgrade.') +param upgradePolicy object = {} @description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered') param cuaId string = '' @@ -27,42 +48,45 @@ var identity_var = { userAssignedIdentities: contains(identity, 'userAssignedIdentities') ? identity.userAssignedIdentities : {} } -var propertiesManagedIdentities_var = [for managedIdentity in properties.managedIdentities: { +var propertiesManagedIdentities_var = [for managedIdentity in managedIdentities: { name: contains(managedIdentity, 'name') ? managedIdentity.name : null principalId: contains(managedIdentity, 'principalId') ? managedIdentity.principalId : null }] -var propertiesMetrics_var = [for metric in properties.metrics: { +var propertiesMetrics_var = [for metric in metrics: { maximumCapacity: contains(metric, 'maximumCapacity') ? metric.maximumCapacity : 0 name: contains(metric, 'name') ? metric.name : null reservationCapacity: contains(metric, 'reservationCapacity') ? metric.reservationCapacity : 0 totalApplicationCapacity: contains(metric, 'totalApplicationCapacity') ? metric.totalApplicationCapacity : 1 }] -var upgradePolicy_var = { +var upgradePolicy_var = union({ + forceRestart: contains(upgradePolicy, 'forceRestart') ? upgradePolicy.forceRestart : false + recreateApplication: contains(upgradePolicy, 'recreateApplication') ? upgradePolicy.recreateApplication : false + upgradeMode: contains(upgradePolicy, 'upgradeMode') ? upgradePolicy.upgradeMode : 'Invalid' + upgradeReplicaSetCheckTimeout: contains(upgradePolicy, 'upgradeReplicaSetCheckTimeout') ? upgradePolicy.upgradeReplicaSetCheckTimeout : null +}, contains(upgradePolicy, 'rollingUpgradeMonitoringPolicy') ? { + rollingUpgradeMonitoringPolicy: { + failureAction: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'failureAction') ? upgradePolicy.rollingUpgradeMonitoringPolicy.failureAction : 'Manual' + healthCheckRetryTimeout: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckRetryTimeout') ? upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckRetryTimeout : null + healthCheckStableDuration: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckStableDuration') ? upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckStableDuration : null + healthCheckWaitDuration: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckWaitDuration') ? upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckWaitDuration : null + upgradeDomainTimeout: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeDomainTimeout') ? upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeDomainTimeout : null + upgradeTimeout: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeTimeout') ? upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeTimeout : null + } +} : {}, contains(upgradePolicy, 'applicationHealthPolicy') ? union({ applicationHealthPolicy: { - considerWarningAsError: contains(properties.upgradePolicy.applicationHealthPolicy, 'considerWarningAsError') ? properties.upgradePolicy.applicationHealthPolicy.considerWarningAsError : false - defaultServiceTypeHealthPolicy: { - maxPercentUnhealthyPartitionsPerService: contains(properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyPartitionsPerService') ? properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyPartitionsPerService : 0 - maxPercentUnhealthyReplicasPerPartition: contains(properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyReplicasPerPartition') ? properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyReplicasPerPartition : 0 - maxPercentUnhealthyServices: contains(properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyServices') ? properties.upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyServices : 0 - } - maxPercentUnhealthyDeployedApplications: contains(properties.upgradePolicy.applicationHealthPolicy, 'maxPercentUnhealthyDeployedApplications') ? properties.upgradePolicy.applicationHealthPolicy.maxPercentUnhealthyDeployedApplications : 0 - serviceTypeHealthPolicyMap: contains(properties.upgradePolicy.applicationHealthPolicy, 'serviceTypeHealthPolicyMap') ? properties.upgradePolicy.applicationHealthPolicy.serviceTypeHealthPolicyMap : {} + considerWarningAsError: contains(upgradePolicy.applicationHealthPolicy, 'considerWarningAsError') ? upgradePolicy.applicationHealthPolicy.considerWarningAsError : false + maxPercentUnhealthyDeployedApplications: contains(upgradePolicy.applicationHealthPolicy, 'maxPercentUnhealthyDeployedApplications') ? upgradePolicy.applicationHealthPolicy.maxPercentUnhealthyDeployedApplications : 0 + serviceTypeHealthPolicyMap: contains(upgradePolicy.applicationHealthPolicy, 'serviceTypeHealthPolicyMap') ? upgradePolicy.applicationHealthPolicy.serviceTypeHealthPolicyMap : {} } - forceRestart: contains(properties.upgradePolicy, 'forceRestart') ? properties.upgradePolicy.forceRestart : false - recreateApplication: contains(properties.upgradePolicy, 'recreateApplication') ? properties.upgradePolicy.recreateApplication : false - rollingUpgradeMonitoringPolicy: { - failureAction: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'failureAction') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.failureAction : 'Manual' - healthCheckRetryTimeout: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckRetryTimeout') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckRetryTimeout : null - healthCheckStableDuration: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckStableDuration') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckStableDuration : null - healthCheckWaitDuration: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckWaitDuration') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckWaitDuration : null - upgradeDomainTimeout: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeDomainTimeout') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeDomainTimeout : null - upgradeTimeout: contains(properties.upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeTimeout') ? properties.upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeTimeout : null +}, contains(upgradePolicy.applicationHealthPolicy, 'defaultServiceTypeHealthPolicy') ? { + defaultServiceTypeHealthPolicy: { + maxPercentUnhealthyPartitionsPerService: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyPartitionsPerService') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyPartitionsPerService : 0 + maxPercentUnhealthyReplicasPerPartition: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyReplicasPerPartition') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyReplicasPerPartition : 0 + maxPercentUnhealthyServices: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyServices') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyServices : 0 } - upgradeMode: contains(properties.upgradePolicy, 'upgradeMode') ? properties.upgradePolicy.upgradeMode : 'Invalid' - upgradeReplicaSetCheckTimeout: contains(properties.upgradePolicy, 'upgradeReplicaSetCheckTimeout') ? properties.upgradePolicy.upgradeReplicaSetCheckTimeout : null -} +} : {}) : {}) module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { name: 'pid-${cuaId}' @@ -76,19 +100,18 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' exis resource applications 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = { name: name parent: serviceFabricCluster - location: location tags: tags identity: !empty(identity) ? identity_var : null properties: { - managedIdentities: contains(properties, 'managedIdentities') ? propertiesManagedIdentities_var : [] - maximumNodes: contains(properties, 'maximumNodes') ? properties.maximumNodes : 0 - metrics: contains(properties, 'metrics') ? propertiesMetrics_var : [] - minimumNodes: contains(properties, 'minimumNodes') ? properties.minimumNodes : 0 - parameters: contains(properties, 'parameters') ? properties.parameters : {} - removeApplicationCapacity: contains(properties, 'removeApplicationCapacity') ? properties.removeApplicationCapacity : false - typeName: contains(properties, 'typeName') ? properties.typeName : null - typeVersion: contains(properties, 'typeVersion') ? properties.typeVersion : null - upgradePolicy: contains(properties, 'upgradePolicy') ? upgradePolicy_var : {} + managedIdentities: !empty(managedIdentities) ? propertiesManagedIdentities_var : [] + maximumNodes: maximumNodes + metrics: !empty(metrics) ? propertiesMetrics_var : [] + minimumNodes: minimumNodes + parameters: parameters + removeApplicationCapacity: removeApplicationCapacity + typeName: !empty(typeName) ? typeName : null + typeVersion: !empty(typeVersion) ? typeVersion : null + upgradePolicy: !empty(upgradePolicy) ? upgradePolicy_var : {} } } @@ -98,7 +121,25 @@ module applications_services 'services/deploy.bicep' = [for (service, index) in serviceFabricClusterName: serviceFabricCluster.name applicationName: applications.name name: contains(service, 'name') ? service.name : 'defaultService' - properties: contains(service, 'properties') ? service.properties : {} + correlationScheme: contains(service, 'correlationScheme') ? service.correlationScheme : [] + defaultMoveCost: contains(service, 'defaultMoveCost') ? service.defaultMoveCost : '' + hasPersistedState: contains(service, 'hasPersistedState') ? service.hasPersistedState : true + instanceCloseDelayDuration: contains(service, 'instanceCloseDelayDuration') ? service.instanceCloseDelayDuration : '' + instanceCount: contains(service, 'instanceCount') ? service.instanceCount : -1 + minReplicaSetSize: contains(service, 'minReplicaSetSize') ? service.minReplicaSetSize : 1 + partitionDescription: contains(service, 'partitionDescription') ? service.partitionDescription : {} + placementConstraints: contains(service, 'placementConstraints') ? service.placementConstraints : '' + quorumLossWaitDuration: contains(service, 'quorumLossWaitDuration') ? service.quorumLossWaitDuration : '' + replicaRestartWaitDuration: contains(service, 'replicaRestartWaitDuration') ? service.replicaRestartWaitDuration : '' + serviceDnsName: contains(service, 'serviceDnsName') ? service.serviceDnsName : '' + serviceKind: contains(service, 'serviceKind') ? service.serviceKind : '' + serviceLoadMetrics: contains(service, 'serviceLoadMetrics') ? service.serviceLoadMetrics : [] + servicePackageActivationMode: contains(service, 'servicePackageActivationMode') ? service.servicePackageActivationMode : '' + servicePlacementPolicies: contains(service, 'servicePlacementPolicies') ? service.servicePlacementPolicies : [] + serviceTypeName: contains(service, 'serviceTypeName') ? service.serviceTypeName : '' + standByReplicaKeepDuration: contains(service, 'standByReplicaKeepDuration') ? service.standByReplicaKeepDuration : '' + tags: contains(service, 'tags') ? service.tags : {} + targetReplicaSetSize: contains(service, 'targetReplicaSetSize') ? service.targetReplicaSetSize : 1 } }] diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep index d0e7e46887..dc5cad8214 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep @@ -7,24 +7,84 @@ param applicationName string = 'defaultApplication' @description('Optional. Name of the Service.') param name string = 'defaultService' -@description('Optional. Properties of the Service.') -param properties object = {} - -@description('Optional. Location for all resources.') -param location string = resourceGroup().location - @description('Optional. Tags of the resource.') param tags object = {} +@description('Optional. A list that describes the correlation of the service with other services.') +param correlationScheme array = [] + +@description('Optional. Specifies the move cost for the service.') +@allowed([ + 'High' + 'Low' + 'Medium' + 'Zero' + '' +]) +param defaultMoveCost string = '' + +@description('Optional. Describes how the service is partitioned.') +param partitionDescription object = {} + +@description('Optional. The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)".') +param placementConstraints string = '' + +@description('Optional. Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name.') +param serviceDnsName string = '' + +@description('Optional. The service load metrics is given as an array of ServiceLoadMetricDescription objects.') +param serviceLoadMetrics array = [] + +@description('Optional. The activation Mode of the service package') +@allowed([ + 'ExclusiveProcess' + 'SharedProcess' + '' +]) +param servicePackageActivationMode string = '' + +@description('Optional. A list that describes the correlation of the service with other services.') +param servicePlacementPolicies array = [] + +@description('Optional. The name of the service type') +param serviceTypeName string = '' + +@description('Optional. Set the object type') +@allowed([ + 'Stateful' + 'Stateless' + '' +]) +param serviceKind string = '' + +@description('Optional. A flag indicating whether this is a persistent service which stores states on the local disk. If it is then the value of this property is true, if not it is false.') +param hasPersistedState bool = true + +@description('Optional. The minimum replica set size as a number.') +param minReplicaSetSize int = 1 + +@description('Optional. The maximum duration for which a partition is allowed to be in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s).') +param quorumLossWaitDuration string = '' + +@description('Optional. The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s).') +param replicaRestartWaitDuration string = '' + +@description('Optional. The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s).') +param standByReplicaKeepDuration string = '' + +@description('Optional. The target replica set size as a number.') +param targetReplicaSetSize int = 1 + +@description('Optional. Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds.') +param instanceCloseDelayDuration string = '' + +@description('Optional. The instance count.') +param instanceCount int = -1 + @description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered') param cuaId string = '' -var correlationScheme_var = [for correlationScheme in items(properties.value.correlationScheme): { - scheme: contains(correlationScheme.key, 'scheme') ? correlationScheme.value.scheme : null - serviceName: contains(correlationScheme.key, 'serviceName') ? correlationScheme.value.serviceName : null -}] - -var serviceLoadMetrics_var = [for serviceLoadMetric in items(properties.value.serviceLoadMetrics): { +var serviceLoadMetrics_var = [for serviceLoadMetric in serviceLoadMetrics: { defaultLoad: contains(serviceLoadMetric, 'defaultLoad') ? serviceLoadMetric.value.defaultLoad : 1 name: contains(serviceLoadMetric.value, 'name') ? serviceLoadMetric.value.name : null primaryDefaultLoad: contains(serviceLoadMetric, 'primaryDefaultLoad') ? serviceLoadMetric.value.primaryDefaultLoad : 1 @@ -32,28 +92,37 @@ var serviceLoadMetrics_var = [for serviceLoadMetric in items(properties.value.se weight: contains(serviceLoadMetric.value, 'weight') ? serviceLoadMetric.value.weight : null }] -var properties_var = { - correlationScheme: contains(properties, 'correlationScheme') ? correlationScheme_var : [] - defaultMoveCost: contains(properties, 'defaultMoveCost') ? properties.defaultMoveCost : null +var properties = union({ + correlationScheme: correlationScheme + defaultMoveCost: !empty(defaultMoveCost) ? defaultMoveCost : null + placementConstraints: !empty(placementConstraints) ? placementConstraints : null + serviceDnsName: !empty(serviceDnsName) ? serviceDnsName : null + // serviceLoadMetrics: contains(properties, 'serviceLoadMetrics') ? serviceLoadMetrics_var : [] + servicePackageActivationMode: !empty(servicePackageActivationMode) ? servicePackageActivationMode : null + servicePlacementPolicies: !empty(servicePlacementPolicies) ? servicePlacementPolicies : [] + serviceTypeName: !empty(serviceTypeName) ? serviceTypeName : null + serviceKind: !empty(serviceKind) ? serviceKind : null +}, (!empty(partitionDescription) ? { partitionDescription: { - partitionScheme: contains(properties.partitionDescription, 'partitionScheme') ? properties.partitionDescription.partitionScheme : null - count: contains(properties.partitionDescription, 'count') ? properties.partitionDescription.count : 1 - names: contains(properties.partitionDescription, 'names') ? properties.partitionDescription.names : [] + partitionScheme: contains(partitionDescription, 'partitionScheme') ? partitionDescription.partitionScheme : null + count: contains(partitionDescription, 'count') ? partitionDescription.count : 1 + names: contains(partitionDescription, 'names') ? partitionDescription.names : [] } - placementConstraints: contains(properties, 'placementConstraints') ? properties.placementConstraints : null - serviceDnsName: contains(properties, 'serviceDnsName') ? properties.serviceDnsName : null - serviceLoadMetrics: contains(properties, 'serviceLoadMetrics') ? serviceLoadMetrics_var : [] - servicePackageActivationMode: contains(properties, 'servicePackageActivationMode') ? properties.servicePackageActivationMode : null - servicePlacementPolicies: contains(properties, 'servicePlacementPolicies') ? properties.servicePlacementPolicies : [] - serviceTypeName: contains(properties, 'serviceTypeName') ? properties.serviceTypeName : null - serviceKind: contains(properties, 'serviceKind') ? properties.serviceKind : null - hasPersistedState: contains(properties, 'hasPersistedState') ? properties.hasPersistedState : true - minReplicaSetSize: contains(properties, 'minReplicaSetSize') ? properties.minReplicaSetSize : 1 - quorumLossWaitDuration: contains(properties, 'quorumLossWaitDuration') ? properties.quorumLossWaitDuration : null - replicaRestartWaitDuration: contains(properties, 'replicaRestartWaitDuration') ? properties.replicaRestartWaitDuration : null - standByReplicaKeepDuration: contains(properties, 'standByReplicaKeepDuration') ? properties.standByReplicaKeepDuration : null - targetReplicaSetSize: contains(properties, 'targetReplicaSetSize') ? properties.targetReplicaSetSize : 1 -} +} : {}), (!empty(serviceLoadMetrics) ? { + serviceLoadMetrics: serviceLoadMetrics_var +} : {}), (serviceKind == 'Stateful' ? { + 'serviceKind': serviceKind + hasPersistedState: hasPersistedState + minReplicaSetSize: minReplicaSetSize + quorumLossWaitDuration: quorumLossWaitDuration + replicaRestartWaitDuration: replicaRestartWaitDuration + standByReplicaKeepDuration: standByReplicaKeepDuration + targetReplicaSetSize: targetReplicaSetSize +} : {}), (serviceKind == 'Stateless' ? { + 'serviceKind': serviceKind + instanceCloseDelayDuration: instanceCloseDelayDuration + instanceCount: instanceCount +} : {})) module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { name: 'pid-${cuaId}' @@ -71,9 +140,8 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' exis resource services 'Microsoft.ServiceFabric/clusters/applications/services@2021-06-01' = { name: name parent: serviceFabricCluster::applications - location: location tags: tags - properties: !empty(properties) ? properties_var : {} + properties: properties } @description('The resource name of the service.') diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index cb2fa51746..a5f60d68e8 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -228,7 +228,7 @@ var reverseProxyCertificateCommonNames_var = { x509StoreName: contains(reverseProxyCertificateCommonNames, 'x509StoreName') ? reverseProxyCertificateCommonNames.x509StoreName : null } -var upgradeDescription_var = { +var upgradeDescription_var = union({ deltaHealthPolicy: { applicationDeltaHealthPolicies: contains(upgradeDescription, 'applicationDeltaHealthPolicies') ? upgradeDescription.applicationDeltaHealthPolicies : {} maxPercentDeltaUnhealthyApplications: contains(upgradeDescription, 'maxPercentDeltaUnhealthyApplications') ? upgradeDescription.maxPercentDeltaUnhealthyApplications : 0 @@ -239,15 +239,16 @@ var upgradeDescription_var = { healthCheckRetryTimeout: contains(upgradeDescription, 'healthCheckRetryTimeout') ? upgradeDescription.healthCheckRetryTimeout : '00:30:00' healthCheckStableDuration: contains(upgradeDescription, 'healthCheckStableDuration') ? upgradeDescription.healthCheckStableDuration : '01:00:00' healthCheckWaitDuration: contains(upgradeDescription, 'healthCheckWaitDuration') ? upgradeDescription.healthCheckWaitDuration : '00:15:00' + upgradeDomainTimeout: contains(upgradeDescription, 'upgradeDomainTimeout') ? upgradeDescription.upgradeDomainTimeout : '01:00:00' + upgradeReplicaSetCheckTimeout: contains(upgradeDescription, 'upgradeReplicaSetCheckTimeout') ? upgradeDescription.upgradeReplicaSetCheckTimeout : '03:00:00' + upgradeTimeout: contains(upgradeDescription, 'upgradeTimeout') ? upgradeDescription.upgradeTimeout : '02:00:00' +}, contains(upgradeDescription, 'healthPolicy') ? { healthPolicy: { applicationHealthPolicies: contains(upgradeDescription.healthPolicy, 'applicationHealthPolicies') ? upgradeDescription.healthPolicy.applicationHealthPolicies : {} maxPercentUnhealthyApplications: contains(upgradeDescription.healthPolicy, 'maxPercentUnhealthyApplications') ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : 10 maxPercentUnhealthyNodes: contains(upgradeDescription.healthPolicy, 'maxPercentUnhealthyNodes') ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : 10 } - upgradeDomainTimeout: contains(upgradeDescription, 'upgradeDomainTimeout') ? upgradeDescription.upgradeDomainTimeout : '01:00:00' - upgradeReplicaSetCheckTimeout: contains(upgradeDescription, 'upgradeReplicaSetCheckTimeout') ? upgradeDescription.upgradeReplicaSetCheckTimeout : '03:00:00' - upgradeTimeout: contains(upgradeDescription, 'upgradeTimeout') ? upgradeDescription.upgradeTimeout : '02:00:00' -} +} : {}) module pid_cuaId './.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { name: 'pid-${cuaId}' @@ -318,8 +319,7 @@ module serviceFabricCluster_applicationTypes 'applicationTypes/deploy.bicep' = [ params: { name: applicationType.name serviceFabricClusterName: serviceFabricCluster.name - properties: contains(applicationType, 'properties') ? applicationType.properties : {} - tags: tags + tags: contains(applicationType, 'tags') ? applicationType.tags : {} versions: contains(applicationType, 'versions') ? applicationType.versions : [] } }] @@ -331,9 +331,17 @@ module serviceFabricCluster_applications 'applications/deploy.bicep' = [for appl serviceFabricClusterName: serviceFabricCluster.name name: contains(application, 'name') ? application.name : 'defaultApplication' identity: contains(application, 'identity') ? application.identity : {} - properties: contains(application, 'properties') ? application.properties : {} + managedIdentities: contains(application, 'managedIdentities') ? application.managedIdentities : [] services: contains(application, 'applicationsServices') ? application.applicationsServices : [] - tags: tags + tags: contains(application, 'tags') ? application.tags : {} + minimumNodes: contains(application, 'minimumNodes') ? application.minimumNodes : 0 + maximumNodes: contains(application, 'maximumNodes') ? application.maximumNodes : 0 + metrics: contains(application, 'metrics') ? application.metrics : [] + parameters: contains(application, 'parameters') ? application.parameters : {} + removeApplicationCapacity: contains(application, 'removeApplicationCapacity') ? application.removeApplicationCapacity : false + typeName: contains(application, 'typeName') ? application.typeName : '' + typeVersion: contains(application, 'typeVersion') ? application.typeVersion : '' + upgradePolicy: contains(application, 'upgradePolicy') ? application.upgradePolicy : {} } dependsOn: [ serviceFabricCluster_applicationTypes @@ -343,9 +351,6 @@ module serviceFabricCluster_applications 'applications/deploy.bicep' = [for appl @description('The Service Fabric Cluster name.') output clusterName string = serviceFabricCluster.name -@description('The Service Fabric Cluster object.') -output clusterObject object = serviceFabricCluster - @description('The Service Fabric Cluster resource group.') output clusterResourceGroup string = resourceGroup().name From b2f461825228d7b2c56c8bc3034f738032bb0a73 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 14:12:27 +0100 Subject: [PATCH 29/50] Update to latest --- .../clusters/.parameters/parameters.json | 39 +++++++++---------- .../clusters/applications/deploy.bicep | 22 +++++------ 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index d702e9f75a..aca65ba22c 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -145,7 +145,7 @@ "applications": { "value": [ { - "name": "serviceFabricClusterApplication01", + "name": "Voting", "identity": { "type": "None", "userAssignedIdentities": {} @@ -165,11 +165,9 @@ "totalApplicationCapacity": null } ], - "minimumNodes": null, - "parameters": {}, - "removeApplicationCapacity": "", - "typeName": "DotNetCore", - "typeVersion": "VersionOne", + "removeApplicationCapacity": false, + "typeName": "VotingType", + "typeVersion": "1.0.0", "upgradePolicy": { "applicationHealthPolicy": { "considerWarningAsError": "", @@ -209,19 +207,20 @@ } } ] - } //, - // "applicationTypes": { - // "value": [ - // { - // "name": "DotNetCore", - // "versions": [ - // { - // "name": "VersionTwo", - // "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/raw/master/WordCountV2.sfpkg" - // } - // ] - // } - // ] - // } + }, + "applicationTypes": { + "value": [ + { + "name": "VotingType", + "versions": [ + { + "name": "1.0.0", + // "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/raw/master/WordCountV2.sfpkg" + "appPackageUrl": "https://servicefabricapps.blob.core.windows.net/apps/Voting.sfpkg" + } + ] + } + ] + } } } diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep index 4aa4479778..a5da8bbc02 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep @@ -65,7 +65,7 @@ var upgradePolicy_var = union({ recreateApplication: contains(upgradePolicy, 'recreateApplication') ? upgradePolicy.recreateApplication : false upgradeMode: contains(upgradePolicy, 'upgradeMode') ? upgradePolicy.upgradeMode : 'Invalid' upgradeReplicaSetCheckTimeout: contains(upgradePolicy, 'upgradeReplicaSetCheckTimeout') ? upgradePolicy.upgradeReplicaSetCheckTimeout : null -}, contains(upgradePolicy, 'rollingUpgradeMonitoringPolicy') ? { +}, (contains(upgradePolicy, 'rollingUpgradeMonitoringPolicy') ? { rollingUpgradeMonitoringPolicy: { failureAction: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'failureAction') ? upgradePolicy.rollingUpgradeMonitoringPolicy.failureAction : 'Manual' healthCheckRetryTimeout: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckRetryTimeout') ? upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckRetryTimeout : null @@ -74,19 +74,19 @@ var upgradePolicy_var = union({ upgradeDomainTimeout: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeDomainTimeout') ? upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeDomainTimeout : null upgradeTimeout: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeTimeout') ? upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeTimeout : null } -} : {}, contains(upgradePolicy, 'applicationHealthPolicy') ? union({ - applicationHealthPolicy: { +} : {}), (contains(upgradePolicy, 'applicationHealthPolicy') ? { + applicationHealthPolicy: union({ considerWarningAsError: contains(upgradePolicy.applicationHealthPolicy, 'considerWarningAsError') ? upgradePolicy.applicationHealthPolicy.considerWarningAsError : false maxPercentUnhealthyDeployedApplications: contains(upgradePolicy.applicationHealthPolicy, 'maxPercentUnhealthyDeployedApplications') ? upgradePolicy.applicationHealthPolicy.maxPercentUnhealthyDeployedApplications : 0 serviceTypeHealthPolicyMap: contains(upgradePolicy.applicationHealthPolicy, 'serviceTypeHealthPolicyMap') ? upgradePolicy.applicationHealthPolicy.serviceTypeHealthPolicyMap : {} - } -}, contains(upgradePolicy.applicationHealthPolicy, 'defaultServiceTypeHealthPolicy') ? { - defaultServiceTypeHealthPolicy: { - maxPercentUnhealthyPartitionsPerService: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyPartitionsPerService') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyPartitionsPerService : 0 - maxPercentUnhealthyReplicasPerPartition: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyReplicasPerPartition') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyReplicasPerPartition : 0 - maxPercentUnhealthyServices: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyServices') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyServices : 0 - } -} : {}) : {}) + }, (contains(upgradePolicy.applicationHealthPolicy, 'defaultServiceTypeHealthPolicy') ? { + defaultServiceTypeHealthPolicy: { + maxPercentUnhealthyPartitionsPerService: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyPartitionsPerService') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyPartitionsPerService : 0 + maxPercentUnhealthyReplicasPerPartition: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyReplicasPerPartition') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyReplicasPerPartition : 0 + maxPercentUnhealthyServices: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyServices') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyServices : 0 + } + } : {})) +} : {})) module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { name: 'pid-${cuaId}' From a2ea050e755568e6150bc50751c6eaa2481955ce Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 17:55:09 +0100 Subject: [PATCH 30/50] Removed any trace of resource we currently cannot test --- .../clusters/.parameters/parameters.json | 75 +-------- .../clusters/applicationTypes/deploy.bicep | 14 -- .../versions/.bicep/nested_cuaId.bicep | 0 .../applicationTypes/versions/deploy.bicep | 48 ------ .../applicationTypes/versions/readme.md | 55 ------- .../applications/.bicep/nested_cuaId.bicep | 0 .../clusters/applications/deploy.bicep | 153 ----------------- .../clusters/applications/readme.md | 58 ------- .../services/.bicep/nested_cuaId.bicep | 0 .../applications/services/deploy.bicep | 154 ------------------ .../clusters/applications/services/readme.md | 55 ------- .../clusters/deploy.bicep | 25 --- 12 files changed, 1 insertion(+), 636 deletions(-) delete mode 100644 arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/.bicep/nested_cuaId.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/readme.md delete mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/.bicep/nested_cuaId.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/readme.md delete mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/services/.bicep/nested_cuaId.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep delete mode 100644 arm/Microsoft.ServiceFabric/clusters/applications/services/readme.md diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index aca65ba22c..c434a893e3 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -142,83 +142,10 @@ } ] }, - "applications": { - "value": [ - { - "name": "Voting", - "identity": { - "type": "None", - "userAssignedIdentities": {} - }, - "managedIdentities": [ - { - "name": "Identity_Friendly_Name", - "principalId": "e58511af-4da2-449c-a5cd-6a10271cfb83" - } - ], - "maximumNodes": 2, - "metrics": [ - { - "maximumCapacity": null, - "name": null, - "reservationCapacity": null, - "totalApplicationCapacity": null - } - ], - "removeApplicationCapacity": false, - "typeName": "VotingType", - "typeVersion": "1.0.0", - "upgradePolicy": { - "applicationHealthPolicy": { - "considerWarningAsError": "", - "defaultServiceTypeHealthPolicy": { - "maxPercentUnhealthyPartitionsPerService": null, - "maxPercentUnhealthyReplicasPerPartition": null, - "maxPercentUnhealthyServices": null - }, - "maxPercentUnhealthyDeployedApplications": null, - "serviceTypeHealthPolicyMap": {} - }, - "forceRestart": "", - "recreateApplication": "", - "rollingUpgradeMonitoringPolicy": { - "failureAction": null, - "healthCheckRetryTimeout": null, - "healthCheckStableDuration": null, - "healthCheckWaitDuration": null, - "upgradeDomainTimeout": null, - "upgradeTimeout": null - }, - "upgradeMode": "UnmonitoredAuto", - "upgradeReplicaSetCheckTimeout": null - }, - "services": { - "value": [ - { - "name": "Service01", - "correlationScheme": [ - { - "scheme": "Invalid", - "serviceName": "fabric:service01" - } - ] - } - ] - } - } - ] - }, "applicationTypes": { "value": [ { - "name": "VotingType", - "versions": [ - { - "name": "1.0.0", - // "appPackageUrl": "https://github.com/Azure-Samples/service-fabric-wordcount/raw/master/WordCountV2.sfpkg" - "appPackageUrl": "https://servicefabricapps.blob.core.windows.net/apps/Voting.sfpkg" - } - ] + "name": "WordCount" } ] } diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep index 6f1455631b..dd981b6cf7 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep @@ -4,9 +4,6 @@ param serviceFabricClusterName string = '' @description('Optional. Application type name.') param name string = 'defaultApplicationType' -@description('Optional. Array of Versions to create.') -param versions array = [] - @description('Optional. Tags of the resource.') param tags object = {} @@ -28,17 +25,6 @@ resource applicationTypes 'Microsoft.ServiceFabric/clusters/applicationTypes@202 tags: tags } -module applicationTypes_versions 'versions/deploy.bicep' = [for (version, index) in versions: { - name: '${deployment().name}-SFC-Versions-${index}' - params: { - applicationTypeName: name - serviceFabricClusterName: serviceFabricClusterName - tags: contains(versions, 'tags') ? version.tags : {} - appPackageUrl: version.appPackageUrl - name: contains(versions, 'name') ? version.name : 'default' - } -}] - @description('The resource name of the Application type.') output applicationTypeName string = applicationTypes.name diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/.bicep/nested_cuaId.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/.bicep/nested_cuaId.bicep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep deleted file mode 100644 index 4c45728574..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/deploy.bicep +++ /dev/null @@ -1,48 +0,0 @@ -@description('Required. Name of the Serivce Fabric cluster.') -param serviceFabricClusterName string = '' - -@description('Optional. Application type name.') -param applicationTypeName string = 'default' - -@description('The name of the application type version') -param name string = 'defaultVersion' - -@description('Optional. Tags of the resource.') -param tags object = {} - -@description('Required. The URL to the application package.') -param appPackageUrl string - -@description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered') -param cuaId string = '' - -module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { - name: 'pid-${cuaId}' - params: {} -} - -resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' existing = { - name: serviceFabricClusterName - - resource applicationTypes 'applicationTypes@2021-06-01' existing = { - name: applicationTypeName - } -} - -resource versions 'Microsoft.ServiceFabric/clusters/applicationTypes/versions@2021-06-01' = { - name: name - parent: serviceFabricCluster::applicationTypes - tags: tags - properties: { - appPackageUrl: appPackageUrl - } -} - -@description('The name of the Version.') -output versionName string = versions.name - -@description('The resource group of the Version.') -output versionResourceGroup string = resourceGroup().name - -@description('The resource ID of the Version.') -output versionResourceId string = versions.id diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/readme.md b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/readme.md deleted file mode 100644 index ec969bc6bf..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/versions/readme.md +++ /dev/null @@ -1,55 +0,0 @@ -# ServiceFabric Clusters ApplicationTypes Versions `[Microsoft.ServiceFabric/clusters/applicationTypes/versions]` - -This module deploys ServiceFabric Clusters ApplicationTypes Versions. -// TODO: Replace Resource and fill in description - -## Resource Types - -| Resource Type | API Version | -| :-- | :-- | -| `Microsoft.ServiceFabric/clusters/applicationTypes/versions` | 2021-06-01 | - -## Parameters - -| Parameter Name | Type | Default Value | Possible Values | Description | -| :-- | :-- | :-- | :-- | :-- | -| `applicationTypeName` | string | `default` | | Optional. Application type name. | -| `appPackageUrl` | string | | | Required. The URL to the application package. | -| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | -| `location` | string | `[resourceGroup().location]` | | Optional. Location for all resources. | -| `name` | string | `defaultVersion` | | The name of the application type version | -| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | -| `tags` | object | `{object}` | | Optional. Tags of the resource. | - -### Parameter Usage: `` - -// TODO: Fill in Parameter usage - -### Parameter Usage: `tags` - -Tag names and tag values can be provided as needed. A tag can be left without a value. - -```json -"tags": { - "value": { - "Environment": "Non-Prod", - "Contact": "test.user@testcompany.com", - "PurchaseOrder": "1234", - "CostCenter": "7890", - "ServiceName": "DeploymentValidation", - "Role": "DeploymentValidation" - } -} -``` - -## Outputs - -| Output Name | Type | Description | -| :-- | :-- | :-- | -| `versionName` | string | The name of the Version. | -| `versionResourceGroup` | string | The resource group of the Version. | -| `versionResourceId` | string | The resource ID of the Version. | - -## Template references - -- [Clusters/Applicationtypes/Versions](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes/versions) diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/.bicep/nested_cuaId.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/.bicep/nested_cuaId.bicep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep deleted file mode 100644 index a5da8bbc02..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/applications/deploy.bicep +++ /dev/null @@ -1,153 +0,0 @@ -@description('Required. Name of the Serivce Fabric cluster.') -param serviceFabricClusterName string = '' - -@description('Optional. Application name.') -param name string = 'defaultApplication' - -@description('Optional. List of Services to be created in the Application.') -param services array = [] - -@description('Optional. Tags of the resource.') -param tags object = {} - -@description('Optional. Describes the managed identities for an Azure resource.') -param identity object = {} - -@description('Optional. List of user assigned identities for the application, each mapped to a friendly name.') -param managedIdentities array = [] - -@description('Optional. The maximum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. By default, the value of this property is zero and it means that the services can be placed on any node.') -param maximumNodes int = 0 - -@description('Optional. The minimum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property.') -param minimumNodes int = 0 - -@description('Optional. List of application capacity metric description.') -param metrics array = [] - -@description('Optional. List of application parameters with overridden values from their default values specified in the application manifest.') -param parameters object = {} - -@description('Optional. Remove the current application capacity settings') -param removeApplicationCapacity bool = false - -@description('Optional. The application type name as defined in the application manifest.') -param typeName string = '' - -@description('Optional. The version of the application type as defined in the application manifest.') -param typeVersion string = '' - -@description('Optional. Describes the policy for a monitored application upgrade.') -param upgradePolicy object = {} - -@description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered') -param cuaId string = '' - -var identity_var = { - type: contains(identity, 'type') ? identity.type : 'None' - userAssignedIdentities: contains(identity, 'userAssignedIdentities') ? identity.userAssignedIdentities : {} -} - -var propertiesManagedIdentities_var = [for managedIdentity in managedIdentities: { - name: contains(managedIdentity, 'name') ? managedIdentity.name : null - principalId: contains(managedIdentity, 'principalId') ? managedIdentity.principalId : null -}] - -var propertiesMetrics_var = [for metric in metrics: { - maximumCapacity: contains(metric, 'maximumCapacity') ? metric.maximumCapacity : 0 - name: contains(metric, 'name') ? metric.name : null - reservationCapacity: contains(metric, 'reservationCapacity') ? metric.reservationCapacity : 0 - totalApplicationCapacity: contains(metric, 'totalApplicationCapacity') ? metric.totalApplicationCapacity : 1 -}] - -var upgradePolicy_var = union({ - forceRestart: contains(upgradePolicy, 'forceRestart') ? upgradePolicy.forceRestart : false - recreateApplication: contains(upgradePolicy, 'recreateApplication') ? upgradePolicy.recreateApplication : false - upgradeMode: contains(upgradePolicy, 'upgradeMode') ? upgradePolicy.upgradeMode : 'Invalid' - upgradeReplicaSetCheckTimeout: contains(upgradePolicy, 'upgradeReplicaSetCheckTimeout') ? upgradePolicy.upgradeReplicaSetCheckTimeout : null -}, (contains(upgradePolicy, 'rollingUpgradeMonitoringPolicy') ? { - rollingUpgradeMonitoringPolicy: { - failureAction: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'failureAction') ? upgradePolicy.rollingUpgradeMonitoringPolicy.failureAction : 'Manual' - healthCheckRetryTimeout: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckRetryTimeout') ? upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckRetryTimeout : null - healthCheckStableDuration: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckStableDuration') ? upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckStableDuration : null - healthCheckWaitDuration: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'healthCheckWaitDuration') ? upgradePolicy.rollingUpgradeMonitoringPolicy.healthCheckWaitDuration : null - upgradeDomainTimeout: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeDomainTimeout') ? upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeDomainTimeout : null - upgradeTimeout: contains(upgradePolicy.rollingUpgradeMonitoringPolicy, 'upgradeTimeout') ? upgradePolicy.rollingUpgradeMonitoringPolicy.upgradeTimeout : null - } -} : {}), (contains(upgradePolicy, 'applicationHealthPolicy') ? { - applicationHealthPolicy: union({ - considerWarningAsError: contains(upgradePolicy.applicationHealthPolicy, 'considerWarningAsError') ? upgradePolicy.applicationHealthPolicy.considerWarningAsError : false - maxPercentUnhealthyDeployedApplications: contains(upgradePolicy.applicationHealthPolicy, 'maxPercentUnhealthyDeployedApplications') ? upgradePolicy.applicationHealthPolicy.maxPercentUnhealthyDeployedApplications : 0 - serviceTypeHealthPolicyMap: contains(upgradePolicy.applicationHealthPolicy, 'serviceTypeHealthPolicyMap') ? upgradePolicy.applicationHealthPolicy.serviceTypeHealthPolicyMap : {} - }, (contains(upgradePolicy.applicationHealthPolicy, 'defaultServiceTypeHealthPolicy') ? { - defaultServiceTypeHealthPolicy: { - maxPercentUnhealthyPartitionsPerService: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyPartitionsPerService') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyPartitionsPerService : 0 - maxPercentUnhealthyReplicasPerPartition: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyReplicasPerPartition') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyReplicasPerPartition : 0 - maxPercentUnhealthyServices: contains(upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy, 'maxPercentUnhealthyServices') ? upgradePolicy.applicationHealthPolicy.defaultServiceTypeHealthPolicy.maxPercentUnhealthyServices : 0 - } - } : {})) -} : {})) - -module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { - name: 'pid-${cuaId}' - params: {} -} - -resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' existing = { - name: serviceFabricClusterName -} - -resource applications 'Microsoft.ServiceFabric/clusters/applications@2021-06-01' = { - name: name - parent: serviceFabricCluster - tags: tags - identity: !empty(identity) ? identity_var : null - properties: { - managedIdentities: !empty(managedIdentities) ? propertiesManagedIdentities_var : [] - maximumNodes: maximumNodes - metrics: !empty(metrics) ? propertiesMetrics_var : [] - minimumNodes: minimumNodes - parameters: parameters - removeApplicationCapacity: removeApplicationCapacity - typeName: !empty(typeName) ? typeName : null - typeVersion: !empty(typeVersion) ? typeVersion : null - upgradePolicy: !empty(upgradePolicy) ? upgradePolicy_var : {} - } -} - -module applications_services 'services/deploy.bicep' = [for (service, index) in services: { - name: '${deployment().name}-SFC-Services-${index}' - params: { - serviceFabricClusterName: serviceFabricCluster.name - applicationName: applications.name - name: contains(service, 'name') ? service.name : 'defaultService' - correlationScheme: contains(service, 'correlationScheme') ? service.correlationScheme : [] - defaultMoveCost: contains(service, 'defaultMoveCost') ? service.defaultMoveCost : '' - hasPersistedState: contains(service, 'hasPersistedState') ? service.hasPersistedState : true - instanceCloseDelayDuration: contains(service, 'instanceCloseDelayDuration') ? service.instanceCloseDelayDuration : '' - instanceCount: contains(service, 'instanceCount') ? service.instanceCount : -1 - minReplicaSetSize: contains(service, 'minReplicaSetSize') ? service.minReplicaSetSize : 1 - partitionDescription: contains(service, 'partitionDescription') ? service.partitionDescription : {} - placementConstraints: contains(service, 'placementConstraints') ? service.placementConstraints : '' - quorumLossWaitDuration: contains(service, 'quorumLossWaitDuration') ? service.quorumLossWaitDuration : '' - replicaRestartWaitDuration: contains(service, 'replicaRestartWaitDuration') ? service.replicaRestartWaitDuration : '' - serviceDnsName: contains(service, 'serviceDnsName') ? service.serviceDnsName : '' - serviceKind: contains(service, 'serviceKind') ? service.serviceKind : '' - serviceLoadMetrics: contains(service, 'serviceLoadMetrics') ? service.serviceLoadMetrics : [] - servicePackageActivationMode: contains(service, 'servicePackageActivationMode') ? service.servicePackageActivationMode : '' - servicePlacementPolicies: contains(service, 'servicePlacementPolicies') ? service.servicePlacementPolicies : [] - serviceTypeName: contains(service, 'serviceTypeName') ? service.serviceTypeName : '' - standByReplicaKeepDuration: contains(service, 'standByReplicaKeepDuration') ? service.standByReplicaKeepDuration : '' - tags: contains(service, 'tags') ? service.tags : {} - targetReplicaSetSize: contains(service, 'targetReplicaSetSize') ? service.targetReplicaSetSize : 1 - } -}] - -@description('The resource name of the Application.') -output applicationName string = applications.name - -@description('The resource group of the Application.') -output applicationResourceGroup string = resourceGroup().name - -@description('The resource ID of the Application.') -output applicationResourceId string = applications.id diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/readme.md b/arm/Microsoft.ServiceFabric/clusters/applications/readme.md deleted file mode 100644 index 91426729a8..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/applications/readme.md +++ /dev/null @@ -1,58 +0,0 @@ -# ServiceFabric Clusters Applications `[Microsoft.ServiceFabric/clusters/applications]` - -This module deploys ServiceFabric Clusters Applications. -// TODO: Replace Resource and fill in description - -## Resource Types - -| Resource Type | API Version | -| :-- | :-- | -| `Microsoft.ServiceFabric/clusters/applications` | 2021-06-01 | -| `Microsoft.ServiceFabric/clusters/applications/services` | 2021-06-01 | - -## Parameters - -| Parameter Name | Type | Default Value | Possible Values | Description | -| :-- | :-- | :-- | :-- | :-- | -| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | -| `identity` | object | `{object}` | | Optional. Describes the managed identities for an Azure resource. | -| `location` | string | `[resourceGroup().location]` | | Optional. Location for all resources. | -| `name` | string | `defaultApplication` | | Optional. Application name. | -| `properties` | object | `{object}` | | Optional. The application resource properties. | -| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | -| `services` | _[services](services/readme.md)_ array | `[]` | | Optional. List of Services to be created in the Application. | -| `tags` | object | `{object}` | | Optional. Tags of the resource. | - -### Parameter Usage: `` - -// TODO: Fill in Parameter usage - -### Parameter Usage: `tags` - -Tag names and tag values can be provided as needed. A tag can be left without a value. - -```json -"tags": { - "value": { - "Environment": "Non-Prod", - "Contact": "test.user@testcompany.com", - "PurchaseOrder": "1234", - "CostCenter": "7890", - "ServiceName": "DeploymentValidation", - "Role": "DeploymentValidation" - } -} -``` - -## Outputs - -| Output Name | Type | Description | -| :-- | :-- | :-- | -| `applicationName` | string | The resource name of the Application. | -| `applicationResourceGroup` | string | The resource group of the Application. | -| `applicationResourceId` | string | The resource ID of the Application. | - -## Template references - -- [Clusters/Applications](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications) -- [Clusters/Applications/Services](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications/services) diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/services/.bicep/nested_cuaId.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/services/.bicep/nested_cuaId.bicep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep deleted file mode 100644 index dc5cad8214..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/applications/services/deploy.bicep +++ /dev/null @@ -1,154 +0,0 @@ -@description('Required. Name of the Serivce Fabric cluster.') -param serviceFabricClusterName string = '' - -@description('Optional. Application name.') -param applicationName string = 'defaultApplication' - -@description('Optional. Name of the Service.') -param name string = 'defaultService' - -@description('Optional. Tags of the resource.') -param tags object = {} - -@description('Optional. A list that describes the correlation of the service with other services.') -param correlationScheme array = [] - -@description('Optional. Specifies the move cost for the service.') -@allowed([ - 'High' - 'Low' - 'Medium' - 'Zero' - '' -]) -param defaultMoveCost string = '' - -@description('Optional. Describes how the service is partitioned.') -param partitionDescription object = {} - -@description('Optional. The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)".') -param placementConstraints string = '' - -@description('Optional. Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name.') -param serviceDnsName string = '' - -@description('Optional. The service load metrics is given as an array of ServiceLoadMetricDescription objects.') -param serviceLoadMetrics array = [] - -@description('Optional. The activation Mode of the service package') -@allowed([ - 'ExclusiveProcess' - 'SharedProcess' - '' -]) -param servicePackageActivationMode string = '' - -@description('Optional. A list that describes the correlation of the service with other services.') -param servicePlacementPolicies array = [] - -@description('Optional. The name of the service type') -param serviceTypeName string = '' - -@description('Optional. Set the object type') -@allowed([ - 'Stateful' - 'Stateless' - '' -]) -param serviceKind string = '' - -@description('Optional. A flag indicating whether this is a persistent service which stores states on the local disk. If it is then the value of this property is true, if not it is false.') -param hasPersistedState bool = true - -@description('Optional. The minimum replica set size as a number.') -param minReplicaSetSize int = 1 - -@description('Optional. The maximum duration for which a partition is allowed to be in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s).') -param quorumLossWaitDuration string = '' - -@description('Optional. The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s).') -param replicaRestartWaitDuration string = '' - -@description('Optional. The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s).') -param standByReplicaKeepDuration string = '' - -@description('Optional. The target replica set size as a number.') -param targetReplicaSetSize int = 1 - -@description('Optional. Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds.') -param instanceCloseDelayDuration string = '' - -@description('Optional. The instance count.') -param instanceCount int = -1 - -@description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered') -param cuaId string = '' - -var serviceLoadMetrics_var = [for serviceLoadMetric in serviceLoadMetrics: { - defaultLoad: contains(serviceLoadMetric, 'defaultLoad') ? serviceLoadMetric.value.defaultLoad : 1 - name: contains(serviceLoadMetric.value, 'name') ? serviceLoadMetric.value.name : null - primaryDefaultLoad: contains(serviceLoadMetric, 'primaryDefaultLoad') ? serviceLoadMetric.value.primaryDefaultLoad : 1 - secondaryDefaultLoad: contains(serviceLoadMetric, 'secondaryDefaultLoad') ? serviceLoadMetric.value.secondaryDefaultLoad : 1 - weight: contains(serviceLoadMetric.value, 'weight') ? serviceLoadMetric.value.weight : null -}] - -var properties = union({ - correlationScheme: correlationScheme - defaultMoveCost: !empty(defaultMoveCost) ? defaultMoveCost : null - placementConstraints: !empty(placementConstraints) ? placementConstraints : null - serviceDnsName: !empty(serviceDnsName) ? serviceDnsName : null - // serviceLoadMetrics: contains(properties, 'serviceLoadMetrics') ? serviceLoadMetrics_var : [] - servicePackageActivationMode: !empty(servicePackageActivationMode) ? servicePackageActivationMode : null - servicePlacementPolicies: !empty(servicePlacementPolicies) ? servicePlacementPolicies : [] - serviceTypeName: !empty(serviceTypeName) ? serviceTypeName : null - serviceKind: !empty(serviceKind) ? serviceKind : null -}, (!empty(partitionDescription) ? { - partitionDescription: { - partitionScheme: contains(partitionDescription, 'partitionScheme') ? partitionDescription.partitionScheme : null - count: contains(partitionDescription, 'count') ? partitionDescription.count : 1 - names: contains(partitionDescription, 'names') ? partitionDescription.names : [] - } -} : {}), (!empty(serviceLoadMetrics) ? { - serviceLoadMetrics: serviceLoadMetrics_var -} : {}), (serviceKind == 'Stateful' ? { - 'serviceKind': serviceKind - hasPersistedState: hasPersistedState - minReplicaSetSize: minReplicaSetSize - quorumLossWaitDuration: quorumLossWaitDuration - replicaRestartWaitDuration: replicaRestartWaitDuration - standByReplicaKeepDuration: standByReplicaKeepDuration - targetReplicaSetSize: targetReplicaSetSize -} : {}), (serviceKind == 'Stateless' ? { - 'serviceKind': serviceKind - instanceCloseDelayDuration: instanceCloseDelayDuration - instanceCount: instanceCount -} : {})) - -module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { - name: 'pid-${cuaId}' - params: {} -} - -resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' existing = { - name: serviceFabricClusterName - - resource applications 'applications@2021-06-01' existing = { - name: applicationName - } -} - -resource services 'Microsoft.ServiceFabric/clusters/applications/services@2021-06-01' = { - name: name - parent: serviceFabricCluster::applications - tags: tags - properties: properties -} - -@description('The resource name of the service.') -output serviceName string = services.name - -@description('The resource group of the service.') -output serviceResourceGroup string = resourceGroup().name - -@description('The resource ID of the service.') -output serviceResourceId string = services.id diff --git a/arm/Microsoft.ServiceFabric/clusters/applications/services/readme.md b/arm/Microsoft.ServiceFabric/clusters/applications/services/readme.md deleted file mode 100644 index be87405bd3..0000000000 --- a/arm/Microsoft.ServiceFabric/clusters/applications/services/readme.md +++ /dev/null @@ -1,55 +0,0 @@ -# ServiceFabric Clusters Applications Services `[Microsoft.ServiceFabric/clusters/applications/services]` - -This module deploys ServiceFabric Clusters Applications Services. -// TODO: Replace Resource and fill in description - -## Resource Types - -| Resource Type | API Version | -| :-- | :-- | -| `Microsoft.ServiceFabric/clusters/applications/services` | 2021-06-01 | - -## Parameters - -| Parameter Name | Type | Default Value | Possible Values | Description | -| :-- | :-- | :-- | :-- | :-- | -| `applicationName` | string | `defaultApplication` | | Optional. Application name. | -| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | -| `location` | string | `[resourceGroup().location]` | | Optional. Location for all resources. | -| `name` | string | `defaultService` | | Optional. Name of the Service. | -| `properties` | object | `{object}` | | Optional. Properties of the Service. | -| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | -| `tags` | object | `{object}` | | Optional. Tags of the resource. | - -### Parameter Usage: `` - -// TODO: Fill in Parameter usage - -### Parameter Usage: `tags` - -Tag names and tag values can be provided as needed. A tag can be left without a value. - -```json -"tags": { - "value": { - "Environment": "Non-Prod", - "Contact": "test.user@testcompany.com", - "PurchaseOrder": "1234", - "CostCenter": "7890", - "ServiceName": "DeploymentValidation", - "Role": "DeploymentValidation" - } -} -``` - -## Outputs - -| Output Name | Type | Description | -| :-- | :-- | :-- | -| `serviceName` | string | The resource name of the service. | -| `serviceResourceGroup` | string | The resource group of the service. | -| `serviceResourceId` | string | The resource ID of the service. | - -## Template references - -- [Clusters/Applications/Services](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications/services) diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index a5f60d68e8..b7bfff3e43 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -320,34 +320,9 @@ module serviceFabricCluster_applicationTypes 'applicationTypes/deploy.bicep' = [ name: applicationType.name serviceFabricClusterName: serviceFabricCluster.name tags: contains(applicationType, 'tags') ? applicationType.tags : {} - versions: contains(applicationType, 'versions') ? applicationType.versions : [] } }] -// Service Fabric cluster applications -module serviceFabricCluster_applications 'applications/deploy.bicep' = [for application in applications: { - name: '${uniqueString(deployment().name, location)}-SFC-${application.name}' - params: { - serviceFabricClusterName: serviceFabricCluster.name - name: contains(application, 'name') ? application.name : 'defaultApplication' - identity: contains(application, 'identity') ? application.identity : {} - managedIdentities: contains(application, 'managedIdentities') ? application.managedIdentities : [] - services: contains(application, 'applicationsServices') ? application.applicationsServices : [] - tags: contains(application, 'tags') ? application.tags : {} - minimumNodes: contains(application, 'minimumNodes') ? application.minimumNodes : 0 - maximumNodes: contains(application, 'maximumNodes') ? application.maximumNodes : 0 - metrics: contains(application, 'metrics') ? application.metrics : [] - parameters: contains(application, 'parameters') ? application.parameters : {} - removeApplicationCapacity: contains(application, 'removeApplicationCapacity') ? application.removeApplicationCapacity : false - typeName: contains(application, 'typeName') ? application.typeName : '' - typeVersion: contains(application, 'typeVersion') ? application.typeVersion : '' - upgradePolicy: contains(application, 'upgradePolicy') ? application.upgradePolicy : {} - } - dependsOn: [ - serviceFabricCluster_applicationTypes - ] -}] - @description('The Service Fabric Cluster name.') output clusterName string = serviceFabricCluster.name From ea0ed9093e44dd7ab6af1bb13a48b82524e283d5 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 20:31:29 +0100 Subject: [PATCH 31/50] Enabled upgrade desc --- .../clusters/.parameters/parameters.json | 119 ++++++++++++------ .../clusters/deploy.bicep | 45 +++---- 2 files changed, 95 insertions(+), 69 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index c434a893e3..40082fa038 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -27,40 +27,49 @@ // "tenantId": "" // } // }, - "certificate": { - "value": { - "thumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", - //"thumbprintSecondary": "", - "x509StoreName": "My" - } - }, - // "certificateCommonNames": { + // "certificate": { // Mutual exclusive with the other cert specs // "value": { - // "commonNames": [ - // { - // "certificateCommonName": "", - // "certificateIssuerThumbprint": "" - // } - // ], - // "x509StoreName": "" + // "thumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", + // "x509StoreName": "My" // } // }, - // "clientCertificateCommonNames": { - // "value": [{ - // "certificateCommonName": "", - // "certificateIssuerThumbprint": "", - // "isAdmin": "" - // }] - // }, - // "clientCertificateThumbprints": { - // "value": [{ - // "certificateThumbprint": "", - // "isAdmin": "" - // }] - // }, - // "clusterCodeVersion": { - // "value": "8.1.329.9590" - // }, + "certificateCommonNames": { + "value": { + "commonNames": [ + { + "certificateCommonName": "certcommon", + "certificateIssuerThumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130" + } + ], + "x509StoreName": "" + } + }, + "clientCertificateCommonNames": { + "value": [ + { + "certificateCommonName": "clientcommoncert1", + "certificateIssuerThumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", + "isAdmin": false + }, + { + "certificateCommonName": "clientcommoncert2", + "certificateIssuerThumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC131", + "isAdmin": false + } + ] + }, + "clientCertificateThumbprints": { + "value": [ + { + "certificateThumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", + "isAdmin": false + }, + { + "certificateThumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC131", + "isAdmin": false + } + ] + }, // "diagnosticsStorageAccountConfig": { // "value": { // "blobEndpoint": "", @@ -82,6 +91,16 @@ } ] } + // , + // { + // "name": "ManagedIdentityTokenService", + // "parameters": [ + // { + // "name": "IsEnabled", + // "value": "true" + // } + // ] + // } ] }, "managementEndpoint": { @@ -123,9 +142,26 @@ // }] // }] // }, - // "upgradeDescription": { - // "value": {} - // }, + "upgradeDescription": { + "value": { + "forceRestart": false, + "upgradeReplicaSetCheckTimeout": "1.00:00:00", + "healthCheckWaitDuration": "00:00:30", + "healthCheckStableDuration": "00:01:00", + "healthCheckRetryTimeout": "00:45:00", + "upgradeTimeout": "02:00:00", + "upgradeDomainTimeout": "02:00:00", + "healthPolicy": { + "maxPercentUnhealthyNodes": 0, + "maxPercentUnhealthyApplications": 0 + }, + "deltaHealthPolicy": { + "maxPercentDeltaUnhealthyNodes": 0, + "maxPercentUpgradeDomainDeltaUnhealthyNodes": 0, + "maxPercentDeltaUnhealthyApplications": 0 + } + } + }, "reliabilityLevel": { "value": "Silver" }, @@ -141,13 +177,14 @@ ] } ] - }, - "applicationTypes": { - "value": [ - { - "name": "WordCount" - } - ] } + // , + // "applicationTypes": { // not idempotent? + // "value": [ + // { + // "name": "WordCount" + // } + // ] + // } } } diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index b7bfff3e43..ff58d3f9de 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -30,7 +30,7 @@ param addOnFeatures array = [] @description('Required. Number of unused versions per application type to keep.') param maxUnusedVersionsToKeep int = 3 -@description('Optional. Object containing Azure active directory client application ID, cluster application ID and tenant ID.') +@description('Optional. The settings to enable AAD authentication on the cluster..') param azureActiveDirectory object = {} @description('Optional. Describes the certificate details like thumbprint of the primary certificate, thumbprint of the secondary certificate and the local certificate store location') @@ -132,33 +132,15 @@ param waveUpgradePaused bool = false @description('Optional. Array of role assignment objects that contain the \'roleDefinitionIdOrName\' and \'principalId\' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or it\'s fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'') param roleAssignments array = [] -@description('Optional. Array of Service Fabric cluster applications.') -param applications array = [] - @description('Optional. Array of Service Fabric cluster application types.') param applicationTypes array = [] -var azureActiveDirectory_var = { - clientApplication: contains(azureActiveDirectory, 'clientApplication') ? azureActiveDirectory.clientApplication : null - clusterApplication: contains(azureActiveDirectory, 'clusterApplication') ? azureActiveDirectory.clusterApplication : null - tenantId: contains(azureActiveDirectory, 'tenantId') ? azureActiveDirectory.tenantId : null -} - var certificate_var = { thumbprint: contains(certificate, 'thumbprint') ? certificate.thumbprint : null thumbprintSecondary: contains(certificate, 'thumbprintSecondary') ? certificate.thumbprintSecondary : null x509StoreName: contains(certificate, 'x509StoreName') ? certificate.x509StoreName : null } -var certificateCommonNamesList_var = [for certificateCommonName in items(certificateCommonNames): { - commonNames: contains(certificateCommonName.key, 'commonNames') ? certificateCommonName.value.commonNames : [] -}] - -var certificateCommonNames_var = { - commonNames: contains(certificateCommonNames, 'commonNames') ? certificateCommonNamesList_var : null - x509StoreName: contains(certificateCommonNames, 'x509StoreName') ? certificateCommonNames.x509StoreName : null -} - var clientCertificateCommonNames_var = [for clientCertificateCommonName in clientCertificateCommonNames: { certificateCommonName: contains(clientCertificateCommonName, 'certificateCommonName') ? clientCertificateCommonName.certificateCommonName : null certificateIssuerThumbprint: contains(clientCertificateCommonName, 'certificateIssuerThumbprint') ? clientCertificateCommonName.certificateIssuerThumbprint : null @@ -236,17 +218,17 @@ var upgradeDescription_var = union({ maxPercentUpgradeDomainDeltaUnhealthyNodes: contains(upgradeDescription, 'maxPercentUpgradeDomainDeltaUnhealthyNodes') ? upgradeDescription.maxPercentUpgradeDomainDeltaUnhealthyNodes : 0 } forceRestart: contains(upgradeDescription, 'forceRestart') ? upgradeDescription.forceRestart : false - healthCheckRetryTimeout: contains(upgradeDescription, 'healthCheckRetryTimeout') ? upgradeDescription.healthCheckRetryTimeout : '00:30:00' - healthCheckStableDuration: contains(upgradeDescription, 'healthCheckStableDuration') ? upgradeDescription.healthCheckStableDuration : '01:00:00' - healthCheckWaitDuration: contains(upgradeDescription, 'healthCheckWaitDuration') ? upgradeDescription.healthCheckWaitDuration : '00:15:00' - upgradeDomainTimeout: contains(upgradeDescription, 'upgradeDomainTimeout') ? upgradeDescription.upgradeDomainTimeout : '01:00:00' - upgradeReplicaSetCheckTimeout: contains(upgradeDescription, 'upgradeReplicaSetCheckTimeout') ? upgradeDescription.upgradeReplicaSetCheckTimeout : '03:00:00' + healthCheckRetryTimeout: contains(upgradeDescription, 'healthCheckRetryTimeout') ? upgradeDescription.healthCheckRetryTimeout : '00:45:00' + healthCheckStableDuration: contains(upgradeDescription, 'healthCheckStableDuration') ? upgradeDescription.healthCheckStableDuration : '00:01:00' + healthCheckWaitDuration: contains(upgradeDescription, 'healthCheckWaitDuration') ? upgradeDescription.healthCheckWaitDuration : '00:00:30' + upgradeDomainTimeout: contains(upgradeDescription, 'upgradeDomainTimeout') ? upgradeDescription.upgradeDomainTimeout : '02:00:00' + upgradeReplicaSetCheckTimeout: contains(upgradeDescription, 'upgradeReplicaSetCheckTimeout') ? upgradeDescription.upgradeReplicaSetCheckTimeout : '1.00:00:00' upgradeTimeout: contains(upgradeDescription, 'upgradeTimeout') ? upgradeDescription.upgradeTimeout : '02:00:00' }, contains(upgradeDescription, 'healthPolicy') ? { healthPolicy: { applicationHealthPolicies: contains(upgradeDescription.healthPolicy, 'applicationHealthPolicies') ? upgradeDescription.healthPolicy.applicationHealthPolicies : {} - maxPercentUnhealthyApplications: contains(upgradeDescription.healthPolicy, 'maxPercentUnhealthyApplications') ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : 10 - maxPercentUnhealthyNodes: contains(upgradeDescription.healthPolicy, 'maxPercentUnhealthyNodes') ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : 10 + maxPercentUnhealthyApplications: contains(upgradeDescription.healthPolicy, 'maxPercentUnhealthyApplications') ? upgradeDescription.healthPolicy.maxPercentUnhealthyApplications : 0 + maxPercentUnhealthyNodes: contains(upgradeDescription.healthPolicy, 'maxPercentUnhealthyNodes') ? upgradeDescription.healthPolicy.maxPercentUnhealthyNodes : 0 } } : {}) @@ -265,9 +247,16 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { applicationTypeVersionsCleanupPolicy: { maxUnusedVersionsToKeep: maxUnusedVersionsToKeep } - azureActiveDirectory: !empty(azureActiveDirectory) ? azureActiveDirectory_var : null + azureActiveDirectory: !empty(azureActiveDirectory) ? { + clientApplication: contains(azureActiveDirectory, 'clientApplication') ? azureActiveDirectory.clientApplication : null + clusterApplication: contains(azureActiveDirectory, 'clusterApplication') ? azureActiveDirectory.clusterApplication : null + tenantId: contains(azureActiveDirectory, 'tenantId') ? azureActiveDirectory.tenantId : null + } : null certificate: !empty(certificate) ? certificate_var : null - certificateCommonNames: !empty(certificateCommonNames) ? certificateCommonNames_var : null + certificateCommonNames: !empty(certificateCommonNames.commonNames) ? { + commonNames: certificateCommonNames.commonNames + x509StoreName: contains(certificateCommonNames, 'certificateCommonNamesx509StoreName') ? certificateCommonNames.certificateCommonNamesx509StoreName : null + } : null clientCertificateCommonNames: !empty(clientCertificateCommonNames) ? clientCertificateCommonNames_var : null clientCertificateThumbprints: !empty(clientCertificateThumbprints) ? clientCertificateThumbprints_var : null clusterCodeVersion: !empty(clusterCodeVersion) ? clusterCodeVersion : null From e9ea1f0d5adc07da7077b8cbf2d25d15f98c8e04 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 20:38:04 +0100 Subject: [PATCH 32/50] Enabled upgrade desc --- .../clusters/.parameters/parameters.json | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index 40082fa038..c1c63faec9 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -131,17 +131,21 @@ } ] }, - // "notifications": { - // "value": [{ - // "isEnabled": "", - // "notificationCategory": "", - // "notificationLevel": "", - // "notificationTargets": [{ - // "notificationChannel": "", - // "receivers": "" - // }] - // }] - // }, + "notifications": { + "value": [ + { + "isEnabled": true, + "notificationCategory": "", + "notificationLevel": "", + "notificationTargets": [ + { + "notificationChannel": "", + "receivers": "" + } + ] + } + ] + }, "upgradeDescription": { "value": { "forceRestart": false, From 67384ebc074b6fc878e1f954290d2e2238a03797 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 20:49:23 +0100 Subject: [PATCH 33/50] Update to latest --- .../clusters/.parameters/parameters.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index c1c63faec9..777a8000de 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -134,13 +134,15 @@ "notifications": { "value": [ { - "isEnabled": true, - "notificationCategory": "", - "notificationLevel": "", + "isEnabled": true, // Required. Indicates if the notification is enabled. + "notificationCategory": "WaveProgress", // Required. The category of notification. Possible values include: "WaveProgress". + "notificationLevel": "Critical", // Required. The level of notification. Possible values include: "Critical", "All". "notificationTargets": [ { - "notificationChannel": "", - "receivers": "" + "notificationChannel": "EmailUser", // Required. The notification channel indicates the type of receivers subscribed to the notification, either user or subscription. Possible values include: "EmailUser", "EmailSubscription". + "receivers": [ + "SomeReceiver" // Required. List of targets that subscribe to the notification. + ] } ] } From fd4b92e2be0dd448208ad2b8e7fa7cd7a6cf7dab Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 20:59:19 +0100 Subject: [PATCH 34/50] Update to latest --- .../clusters/.parameters/parameters.json | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index 777a8000de..1644036c86 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -70,16 +70,15 @@ } ] }, - // "diagnosticsStorageAccountConfig": { - // "value": { - // "blobEndpoint": "", - // "protectedAccountKeyName": "", - // "protectedAccountKeyName2": "", - // "queueEndpoint": "", - // "storageAccountName": "", - // "tableEndpoint": "" - // } - // }, + "diagnosticsStorageAccountConfig": { + "value": { + "blobEndpoint": "https://adpsxxazsaweux001.blob.core.windows.net/", + "protectedAccountKeyName": "StorageAccountKey1", + "queueEndpoint": "https://adpsxxazsaweux001.queue.core.windows.net/", + "storageAccountName": "adpsxxazsaweux001", + "tableEndpoint": "https://adpsxxazsaweux001.table.core.windows.net/" + } + }, "fabricSettings": { "value": [ { @@ -91,16 +90,6 @@ } ] } - // , - // { - // "name": "ManagedIdentityTokenService", - // "parameters": [ - // { - // "name": "IsEnabled", - // "value": "true" - // } - // ] - // } ] }, "managementEndpoint": { From 98e0c37627d4a95aedd1979c80a071d4a0fc5f46 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 21:04:30 +0100 Subject: [PATCH 35/50] Update to latest --- .../clusters/.parameters/parameters.json | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index 1644036c86..566a9fbaf7 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -13,8 +13,10 @@ }, "addOnFeatures": { "value": [ + "RepairManager", "DnsService", - "RepairManager" + "BackupRestoreService", + "ResourceMonitorService" ] }, "maxUnusedVersionsToKeep": { @@ -89,6 +91,15 @@ "value": "EncryptAndSign" } ] + }, + { + "name": "UpgradeService", + "parameters": [ + { + "name": "AppPollIntervalInSeconds", + "value": "60" + } + ] } ] }, @@ -113,10 +124,26 @@ "isPrimary": true, "isStateless": false, "multipleAvailabilityZones": false, - "name": "001Node01", + "name": "Node01", "placementProperties": {}, "reverseProxyEndpointPort": "", "vmInstanceCount": 5 + }, + { + "applicationPorts": { + "endPort": 30000, + "startPort": 20000 + }, + "clientConnectionEndpointPort": 19000, + "durabilityLevel": "Bronze", + "ephemeralPorts": { + "endPort": 64000, + "startPort": 49000 + }, + "httpGatewayEndpointPort": 19007, + "isPrimary": true, + "name": "Node02", + "vmInstanceCount": 5 } ] }, From 66c409e31d3aff9381b0db26eb31d91a68645000 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 21:09:37 +0100 Subject: [PATCH 36/50] Added AAD --- .../clusters/.parameters/parameters.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index 566a9fbaf7..94ee8981e8 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -22,13 +22,13 @@ "maxUnusedVersionsToKeep": { "value": 2 }, - // "azureActiveDirectory": { - // "value": { - // "clientApplication": "", - // "clusterApplication": "", - // "tenantId": "" - // } - // }, + "azureActiveDirectory": { + "value": { + "clientApplication": "e58511af-4da2-449c-a5cd-6a10271cfb83", + "clusterApplication": "cf33fea8-b30f-424f-ab73-c48d99e0b222", + "tenantId": "449fbe1d-9c99-4509-9014-4fd5cf25b014" + } + }, // "certificate": { // Mutual exclusive with the other cert specs // "value": { // "thumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", From 31825396b5a98a2d3c23cf5d74d22c7800b0df8c Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 21:38:57 +0100 Subject: [PATCH 37/50] Added min file --- .../clusters/.parameters/min.parameters.json | 40 +++++++++++++ .../clusters/.parameters/parameters.json | 19 ++++-- .../clusters/deploy.bicep | 60 ++++++++----------- 3 files changed, 79 insertions(+), 40 deletions(-) create mode 100644 arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json new file mode 100644 index 0000000000..f870629358 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "name": { + "value": "sxx-az-sfc-min-001" + }, + // "certificate": { // Mutual exclusive with the other cert specs + // "value": { + // "thumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", + // "x509StoreName": "My" + // } + // }, + "managementEndpoint": { + "value": "https://sxx-az-sfc-weu-x-001.westeurope.cloudapp.azure.com:19080" + }, + "reliabilityLevel": { + "value": "None" + }, + "nodeTypes": { + "value": [ + { + "applicationPorts": { + "endPort": 30000, + "startPort": 20000 + }, + "clientConnectionEndpointPort": 19000, + "durabilityLevel": "Bronze", + "ephemeralPorts": { + "endPort": 65534, + "startPort": 49152 + }, + "httpGatewayEndpointPort": 19080, + "isPrimary": true, + "name": "Node01" + } + ] + } + } +} diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index 94ee8981e8..03b61a80ec 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -3,12 +3,12 @@ "contentVersion": "1.0.0.0", "parameters": { "name": { - "value": "sxx-az-sfc-weu-x-001" + "value": "sxx-az-sfc-x-001" }, "tags": { "value": { "resourceType": "Service Fabric", - "clusterName": "sxx-az-sfc-weu-x-001" + "clusterName": "sxx-az-sfc-x-001" } }, "addOnFeatures": { @@ -72,6 +72,17 @@ } ] }, + "reverseProxyCertificateCommonNames": { + "value": { + "commonNames": [ + { + "certificateCommonName": "carml.com", + "certificateIssuerThumbprint": "12529211F8F14C90AFA9532AD79A6F2CA1C00622" + } + ], + "x509StoreName": "My" + } + }, "diagnosticsStorageAccountConfig": { "value": { "blobEndpoint": "https://adpsxxazsaweux001.blob.core.windows.net/", @@ -201,10 +212,10 @@ ] } // , - // "applicationTypes": { // not idempotent? + // "applicationTypes": { // "value": [ // { - // "name": "WordCount" + // "name": "WordCount" // not idempotent // } // ] // } diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index ff58d3f9de..2ee76ba87e 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -135,12 +135,6 @@ param roleAssignments array = [] @description('Optional. Array of Service Fabric cluster application types.') param applicationTypes array = [] -var certificate_var = { - thumbprint: contains(certificate, 'thumbprint') ? certificate.thumbprint : null - thumbprintSecondary: contains(certificate, 'thumbprintSecondary') ? certificate.thumbprintSecondary : null - x509StoreName: contains(certificate, 'x509StoreName') ? certificate.x509StoreName : null -} - var clientCertificateCommonNames_var = [for clientCertificateCommonName in clientCertificateCommonNames: { certificateCommonName: contains(clientCertificateCommonName, 'certificateCommonName') ? clientCertificateCommonName.certificateCommonName : null certificateIssuerThumbprint: contains(clientCertificateCommonName, 'certificateIssuerThumbprint') ? clientCertificateCommonName.certificateIssuerThumbprint : null @@ -152,15 +146,6 @@ var clientCertificateThumbprints_var = [for clientCertificateThumbprint in clien isAdmin: contains(clientCertificateThumbprint, 'isAdmin') ? clientCertificateThumbprint.isAdmin : false }] -var diagnosticsStorageAccountConfig_var = { - blobEndpoint: contains(diagnosticsStorageAccountConfig, 'blobEndpoint') ? diagnosticsStorageAccountConfig.blobEndpoint : null - protectedAccountKeyName: contains(diagnosticsStorageAccountConfig, 'protectedAccountKeyName') ? diagnosticsStorageAccountConfig.protectedAccountKeyName : null - protectedAccountKeyName2: contains(diagnosticsStorageAccountConfig, 'protectedAccountKeyName2') ? diagnosticsStorageAccountConfig.protectedAccountKeyName2 : null - queueEndpoint: contains(diagnosticsStorageAccountConfig, 'queueEndpoint') ? diagnosticsStorageAccountConfig.queueEndpoint : null - storageAccountName: contains(diagnosticsStorageAccountConfig, 'storageAccountName') ? diagnosticsStorageAccountConfig.storageAccountName : null - tableEndpoint: contains(diagnosticsStorageAccountConfig, 'tableEndpoint') ? diagnosticsStorageAccountConfig.tableEndpoint : null -} - var fabricSettings_var = [for fabricSetting in fabricSettings: { name: contains(fabricSetting, 'name') ? fabricSetting.name : null parameters: contains(fabricSetting, 'parameters') ? fabricSetting.parameters : null @@ -195,21 +180,6 @@ var notifications_var = [for notification in notifications: { notificationTargets: contains(notification, 'notificationTargets') ? notification.notificationTargets : [] }] -var reverseProxyCertificate_var = { - thumbprint: contains(reverseProxyCertificate, 'thumbprint') ? reverseProxyCertificate.thumbprint : null - thumbprintSecondary: contains(reverseProxyCertificate, 'thumbprintSecondary') ? reverseProxyCertificate.thumbprintSecondary : null - x509StoreName: contains(reverseProxyCertificate, 'x509StoreName') ? reverseProxyCertificate.x509StoreName : null -} - -var reverseProxyCertificateCommonNamesList_var = [for reverseProxyCertificateCommonName in items(reverseProxyCertificateCommonNames): { - commonNames: contains(reverseProxyCertificateCommonName.key, 'commonNames') ? reverseProxyCertificateCommonName.value.commonNames : [] -}] - -var reverseProxyCertificateCommonNames_var = { - commonNames: contains(reverseProxyCertificateCommonNames, 'commonNames') ? reverseProxyCertificateCommonNamesList_var : [] - x509StoreName: contains(reverseProxyCertificateCommonNames, 'x509StoreName') ? reverseProxyCertificateCommonNames.x509StoreName : null -} - var upgradeDescription_var = union({ deltaHealthPolicy: { applicationDeltaHealthPolicies: contains(upgradeDescription, 'applicationDeltaHealthPolicies') ? upgradeDescription.applicationDeltaHealthPolicies : {} @@ -252,15 +222,26 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { clusterApplication: contains(azureActiveDirectory, 'clusterApplication') ? azureActiveDirectory.clusterApplication : null tenantId: contains(azureActiveDirectory, 'tenantId') ? azureActiveDirectory.tenantId : null } : null - certificate: !empty(certificate) ? certificate_var : null - certificateCommonNames: !empty(certificateCommonNames.commonNames) ? { - commonNames: certificateCommonNames.commonNames + certificate: !empty(certificate) ? { + thumbprint: contains(certificate, 'thumbprint') ? certificate.thumbprint : null + thumbprintSecondary: contains(certificate, 'thumbprintSecondary') ? certificate.thumbprintSecondary : null + x509StoreName: contains(certificate, 'x509StoreName') ? certificate.x509StoreName : null + } : null + certificateCommonNames: !empty(certificateCommonNames) ? { + commonNames: contains(certificateCommonNames, 'commonNames') ? certificateCommonNames.commonNames : null x509StoreName: contains(certificateCommonNames, 'certificateCommonNamesx509StoreName') ? certificateCommonNames.certificateCommonNamesx509StoreName : null } : null clientCertificateCommonNames: !empty(clientCertificateCommonNames) ? clientCertificateCommonNames_var : null clientCertificateThumbprints: !empty(clientCertificateThumbprints) ? clientCertificateThumbprints_var : null clusterCodeVersion: !empty(clusterCodeVersion) ? clusterCodeVersion : null - diagnosticsStorageAccountConfig: !empty(diagnosticsStorageAccountConfig) ? diagnosticsStorageAccountConfig_var : null + diagnosticsStorageAccountConfig: !empty(diagnosticsStorageAccountConfig) ? { + blobEndpoint: contains(diagnosticsStorageAccountConfig, 'blobEndpoint') ? diagnosticsStorageAccountConfig.blobEndpoint : null + protectedAccountKeyName: contains(diagnosticsStorageAccountConfig, 'protectedAccountKeyName') ? diagnosticsStorageAccountConfig.protectedAccountKeyName : null + protectedAccountKeyName2: contains(diagnosticsStorageAccountConfig, 'protectedAccountKeyName2') ? diagnosticsStorageAccountConfig.protectedAccountKeyName2 : null + queueEndpoint: contains(diagnosticsStorageAccountConfig, 'queueEndpoint') ? diagnosticsStorageAccountConfig.queueEndpoint : null + storageAccountName: contains(diagnosticsStorageAccountConfig, 'storageAccountName') ? diagnosticsStorageAccountConfig.storageAccountName : null + tableEndpoint: contains(diagnosticsStorageAccountConfig, 'tableEndpoint') ? diagnosticsStorageAccountConfig.tableEndpoint : null + } : null eventStoreServiceEnabled: eventStoreServiceEnabled fabricSettings: !empty(fabricSettings) ? fabricSettings_var : null infrastructureServiceManager: infrastructureServiceManager @@ -268,8 +249,15 @@ resource serviceFabricCluster 'Microsoft.ServiceFabric/clusters@2021-06-01' = { nodeTypes: !empty(nodeTypes) ? nodeTypes_var : [] notifications: !empty(notifications) ? notifications_var : null reliabilityLevel: !empty(reliabilityLevel) ? reliabilityLevel : 'None' - reverseProxyCertificate: !empty(reverseProxyCertificate) ? reverseProxyCertificate_var : null - reverseProxyCertificateCommonNames: !empty(reverseProxyCertificateCommonNames) ? reverseProxyCertificateCommonNames_var : null + reverseProxyCertificate: !empty(reverseProxyCertificate) ? { + thumbprint: contains(reverseProxyCertificate, 'thumbprint') ? reverseProxyCertificate.thumbprint : null + thumbprintSecondary: contains(reverseProxyCertificate, 'thumbprintSecondary') ? reverseProxyCertificate.thumbprintSecondary : null + x509StoreName: contains(reverseProxyCertificate, 'x509StoreName') ? reverseProxyCertificate.x509StoreName : null + } : null + reverseProxyCertificateCommonNames: !empty(reverseProxyCertificateCommonNames) ? { + commonNames: contains(reverseProxyCertificateCommonNames, 'commonNames') ? reverseProxyCertificateCommonNames.commonNames : null + x509StoreName: contains(reverseProxyCertificateCommonNames, 'x509StoreName') ? reverseProxyCertificateCommonNames.x509StoreName : null + } : null sfZonalUpgradeMode: !empty(sfZonalUpgradeMode) ? sfZonalUpgradeMode : null upgradeDescription: !empty(upgradeDescription) ? upgradeDescription_var : null upgradeMode: !empty(upgradeMode) ? upgradeMode : null From 77e9528180e9f88c2442ad3ba66e19766ed3eac1 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 21:39:05 +0100 Subject: [PATCH 38/50] Update to latest --- .../clusters/.parameters/min.parameters.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json index f870629358..9685e14754 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json @@ -5,12 +5,6 @@ "name": { "value": "sxx-az-sfc-min-001" }, - // "certificate": { // Mutual exclusive with the other cert specs - // "value": { - // "thumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", - // "x509StoreName": "My" - // } - // }, "managementEndpoint": { "value": "https://sxx-az-sfc-weu-x-001.westeurope.cloudapp.azure.com:19080" }, From ec66706ec8912bead02d21bdb4f7fbb83b215e61 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 21:41:48 +0100 Subject: [PATCH 39/50] Update to latest --- .../clusters/.parameters/min.parameters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json index 9685e14754..bcc750bdc3 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/min.parameters.json @@ -6,7 +6,7 @@ "value": "sxx-az-sfc-min-001" }, "managementEndpoint": { - "value": "https://sxx-az-sfc-weu-x-001.westeurope.cloudapp.azure.com:19080" + "value": "https://sxx-az-sfc-min-001.westeurope.cloudapp.azure.com:19080" }, "reliabilityLevel": { "value": "None" From c833ef47db0016cef52efbe43662ed7dbd1ce831 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 10 Jan 2022 22:09:59 +0100 Subject: [PATCH 40/50] Update to latest --- .../clusters/.parameters/parameters.json | 21 +++-------- .../clusters/applicationTypes/readme.md | 5 --- .../clusters/readme.md | 35 +++++++++++++------ 3 files changed, 29 insertions(+), 32 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json index 03b61a80ec..f14b7ac608 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json @@ -72,17 +72,6 @@ } ] }, - "reverseProxyCertificateCommonNames": { - "value": { - "commonNames": [ - { - "certificateCommonName": "carml.com", - "certificateIssuerThumbprint": "12529211F8F14C90AFA9532AD79A6F2CA1C00622" - } - ], - "x509StoreName": "My" - } - }, "diagnosticsStorageAccountConfig": { "value": { "blobEndpoint": "https://adpsxxazsaweux001.blob.core.windows.net/", @@ -161,14 +150,14 @@ "notifications": { "value": [ { - "isEnabled": true, // Required. Indicates if the notification is enabled. - "notificationCategory": "WaveProgress", // Required. The category of notification. Possible values include: "WaveProgress". - "notificationLevel": "Critical", // Required. The level of notification. Possible values include: "Critical", "All". + "isEnabled": true, + "notificationCategory": "WaveProgress", + "notificationLevel": "Critical", "notificationTargets": [ { - "notificationChannel": "EmailUser", // Required. The notification channel indicates the type of receivers subscribed to the notification, either user or subscription. Possible values include: "EmailUser", "EmailSubscription". + "notificationChannel": "EmailUser", "receivers": [ - "SomeReceiver" // Required. List of targets that subscribe to the notification. + "SomeReceiver" ] } ] diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md index a8ed8f7c67..37ee57ae4c 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md @@ -8,19 +8,15 @@ This module deploys ServiceFabric Clusters ApplicationTypes. | Resource Type | API Version | | :-- | :-- | | `Microsoft.ServiceFabric/clusters/applicationTypes` | 2021-06-01 | -| `Microsoft.ServiceFabric/clusters/applicationTypes/versions` | 2021-06-01 | ## Parameters | Parameter Name | Type | Default Value | Possible Values | Description | | :-- | :-- | :-- | :-- | :-- | | `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | -| `location` | string | `[resourceGroup().location]` | | Optional. Location for all resources. | | `name` | string | `defaultApplicationType` | | Optional. Application type name. | -| `properties` | object | `{object}` | | Optional. The application type name properties. | | `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | | `tags` | object | `{object}` | | Optional. Tags of the resource. | -| `versions` | _[versions](versions/readme.md)_ array | `[]` | | Optional. Array of Versions to create. | ### Parameter Usage: `` @@ -54,4 +50,3 @@ Tag names and tag values can be provided as needed. A tag can be left without a ## Template references - [Clusters/Applicationtypes](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes) -- [Clusters/Applicationtypes/Versions](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes/versions) diff --git a/arm/Microsoft.ServiceFabric/clusters/readme.md b/arm/Microsoft.ServiceFabric/clusters/readme.md index 3bad5a370b..3b21a52023 100644 --- a/arm/Microsoft.ServiceFabric/clusters/readme.md +++ b/arm/Microsoft.ServiceFabric/clusters/readme.md @@ -9,19 +9,15 @@ This module deploys a service fabric cluster | `Microsoft.Authorization/locks` | 2016-09-01 | | `Microsoft.Authorization/roleAssignments` | 2020-04-01-preview | | `Microsoft.ServiceFabric/clusters` | 2021-06-01 | -| `Microsoft.ServiceFabric/clusters/applications` | 2021-06-01 | -| `Microsoft.ServiceFabric/clusters/applications/services` | 2021-06-01 | | `Microsoft.ServiceFabric/clusters/applicationTypes` | 2021-06-01 | -| `Microsoft.ServiceFabric/clusters/applicationTypes/versions` | 2021-06-01 | ## Parameters | Parameter Name | Type | Default Value | Possible Values | Description | | :-- | :-- | :-- | :-- | :-- | | `addOnFeatures` | array | `[]` | `[BackupRestoreService, DnsService, RepairManager, ResourceMonitorService]` | Optional. The list of add-on features to enable in the cluster. | -| `applications` | _[applications](applications/readme.md)_ array | `[]` | | Optional. Array of Service Fabric cluster applications. | | `applicationTypes` | _[applicationTypes](applicationTypes/readme.md)_ array | `[]` | | Optional. Array of Service Fabric cluster application types. | -| `azureActiveDirectory` | object | `{object}` | | Optional. Object containing Azure active directory client application ID, cluster application ID and tenant ID. | +| `azureActiveDirectory` | object | `{object}` | | Optional. The settings to enable AAD authentication on the cluster.. | | `certificate` | object | `{object}` | | Optional. Describes the certificate details like thumbprint of the primary certificate, thumbprint of the secondary certificate and the local certificate store location | | `certificateCommonNames` | object | `{object}` | | Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster. | | `clientCertificateCommonNames` | array | `[]` | | Optional. The list of client certificates referenced by common name that are allowed to manage the cluster. | @@ -39,7 +35,7 @@ This module deploys a service fabric cluster | `name` | string | | | Required. Name of the Service Fabric cluster. | | `nodeTypes` | array | `[]` | | Required. The list of node types in the cluster. | | `notifications` | array | `[]` | | Optional. Indicates a list of notification channels for cluster events. | -| `reliabilityLevel` | string | `None` | `[Bronze, Gold, None, Platinum, Silver]` | Optional. The reliability level sets the replica set size of system services. Learn about ReliabilityLevel (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-capacity). - None - Run the System services with a target replica set count of 1. This should only be used for test clusters. - Bronze - Run the System services with a target replica set count of 3. This should only be used for test clusters. - Silver - Run the System services with a target replica set count of 5. - Gold - Run the System services with a target replica set count of 7. - Platinum - Run the System services with a target replica set count of 9. | +| `reliabilityLevel` | string | | `[Bronze, Gold, None, Platinum, Silver]` | Optional. The reliability level sets the replica set size of system services. Learn about ReliabilityLevel (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-capacity). - None - Run the System services with a target replica set count of 1. This should only be used for test clusters. - Bronze - Run the System services with a target replica set count of 3. This should only be used for test clusters. - Silver - Run the System services with a target replica set count of 5. - Gold - Run the System services with a target replica set count of 7. - Platinum - Run the System services with a target replica set count of 9. | | `reverseProxyCertificate` | object | `{object}` | | Optional. Describes the certificate details. | | `reverseProxyCertificateCommonNames` | object | `{object}` | | Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster. | | `roleAssignments` | array | `[]` | | Optional. Array of role assignment objects that contain the 'roleDefinitionIdOrName' and 'principalId' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or it's fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11' | @@ -54,6 +50,27 @@ This module deploys a service fabric cluster | `vmssZonalUpgradeMode` | string | `Hierarchical` | `[Hierarchical, Parallel]` | Optional. This property defines the upgrade mode for the virtual machine scale set, it is mandatory if a node type with multiple Availability Zones is added. | | `waveUpgradePaused` | bool | | | Optional. Boolean to pause automatic runtime version upgrades to the cluster. | +### Parameter Usage: `notifications` + +```json +"notifications": { + "value": [ + { + "isEnabled": true, // Required. Indicates if the notification is enabled. + "notificationCategory": "WaveProgress", // Required. The category of notification. Possible values include: "WaveProgress". + "notificationLevel": "Critical", // Required. The level of notification. Possible values include: "Critical", "All". + "notificationTargets": [ + { + "notificationChannel": "EmailUser", // Required. The notification channel indicates the type of receivers subscribed to the notification, either user or subscription. Possible values include: "EmailUser", "EmailSubscription". + "receivers": [ + "SomeReceiver" // Required. List of targets that subscribe to the notification. + ] + } + ] + } + ] +} +``` ### Parameter Usage: `roleAssignments` @@ -99,17 +116,13 @@ Tag names and tag values can be provided as needed. A tag can be left without a | Output Name | Type | Description | | :-- | :-- | :-- | | `clusterEndpoint` | string | The Service Fabric Cluster endpoint. | -| `clusterId` | string | The Service Fabric Cluster resource ID. | | `clusterName` | string | The Service Fabric Cluster name. | -| `clusterObject` | object | The Service Fabric Cluster object. | | `clusterResourceGroup` | string | The Service Fabric Cluster resource group. | +| `clusterResourceId` | string | The Service Fabric Cluster resource ID. | ## Template references - [Locks](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2016-09-01/locks) - [Roleassignments](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-04-01-preview/roleAssignments) - [Clusters](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters) -- [Clusters/Applications](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications) -- [Clusters/Applications/Services](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applications/services) - [Clusters/Applicationtypes](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes) -- [Clusters/Applicationtypes/Versions](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes/versions) From eeef425b92e603cc447357a5c1a8aaf5b21a0e34 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 11 Jan 2022 15:34:20 +0100 Subject: [PATCH 41/50] Update to latest --- .../.parameters/cert.parameters copy.json | 40 +++++++++++++++++++ .../{parameters.json => full.parameters.json} | 21 ++++------ 2 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters copy.json rename arm/Microsoft.ServiceFabric/clusters/.parameters/{parameters.json => full.parameters.json} (93%) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters copy.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters copy.json new file mode 100644 index 0000000000..9a8b8fb2b1 --- /dev/null +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters copy.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "name": { + "value": "sxx-az-sfc-min-001" + }, + "managementEndpoint": { + "value": "https://sxx-az-sfc-min-001.westeurope.cloudapp.azure.com:19080" + }, + "reliabilityLevel": { + "value": "None" + }, + "certificate": { + "value": { + "thumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", // Mutual exclusive with the other cert specs + "x509StoreName": "My" + } + }, + "nodeTypes": { + "value": [ + { + "applicationPorts": { + "endPort": 30000, + "startPort": 20000 + }, + "clientConnectionEndpointPort": 19000, + "durabilityLevel": "Bronze", + "ephemeralPorts": { + "endPort": 65534, + "startPort": 49152 + }, + "httpGatewayEndpointPort": 19080, + "isPrimary": true, + "name": "Node01" + } + ] + } + } +} diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json similarity index 93% rename from arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json rename to arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json index f14b7ac608..f89a516709 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json @@ -29,12 +29,6 @@ "tenantId": "449fbe1d-9c99-4509-9014-4fd5cf25b014" } }, - // "certificate": { // Mutual exclusive with the other cert specs - // "value": { - // "thumbprint": "0AC113D5E1D94C401DDEB0EE2B1B96CC130", - // "x509StoreName": "My" - // } - // }, "certificateCommonNames": { "value": { "commonNames": [ @@ -199,14 +193,13 @@ ] } ] + }, + "applicationTypes": { + "value": [ + { + "name": "WordCount" // not idempotent + } + ] } - // , - // "applicationTypes": { - // "value": [ - // { - // "name": "WordCount" // not idempotent - // } - // ] - // } } } From 754aa5be8cc41d1fd2d8ec081efb63e952cac7be Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 11 Jan 2022 15:39:29 +0100 Subject: [PATCH 42/50] Updated param --- .../{cert.parameters copy.json => cert.parameters.json} | 2 +- .../clusters/.parameters/full.parameters.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename arm/Microsoft.ServiceFabric/clusters/.parameters/{cert.parameters copy.json => cert.parameters.json} (96%) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters copy.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters.json similarity index 96% rename from arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters copy.json rename to arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters.json index 9a8b8fb2b1..94ba1ffdcb 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters copy.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters.json @@ -3,7 +3,7 @@ "contentVersion": "1.0.0.0", "parameters": { "name": { - "value": "sxx-az-sfc-min-001" + "value": "sxx-az-sfc-cert-001" }, "managementEndpoint": { "value": "https://sxx-az-sfc-min-001.westeurope.cloudapp.azure.com:19080" diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json index f89a516709..ace8e17d53 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json @@ -3,7 +3,7 @@ "contentVersion": "1.0.0.0", "parameters": { "name": { - "value": "sxx-az-sfc-x-001" + "value": "sxx-az-sfc-full-001" }, "tags": { "value": { From df8e04e16f133c130b9b151f97df83310073b8cb Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 11 Jan 2022 15:41:28 +0100 Subject: [PATCH 43/50] Updated docs --- .../clusters/applicationTypes/deploy.bicep | 2 +- .../clusters/applicationTypes/readme.md | 11 +++-------- arm/Microsoft.ServiceFabric/clusters/readme.md | 4 ++-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep index dd981b6cf7..e9243896e6 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep @@ -1,4 +1,4 @@ -@description('Required. Name of the Serivce Fabric cluster.') +@description('Required. Name of the Service Fabric cluster.') param serviceFabricClusterName string = '' @description('Optional. Application type name.') diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md index 37ee57ae4c..1ec526025e 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md @@ -1,7 +1,6 @@ -# ServiceFabric Clusters ApplicationTypes `[Microsoft.ServiceFabric/clusters/applicationTypes]` +# ServiceFabric Cluster Application Type `[Microsoft.ServiceFabric/clusters/applicationTypes]` -This module deploys ServiceFabric Clusters ApplicationTypes. -// TODO: Replace Resource and fill in description +This module deploys a ServiceFabric cluster application type. ## Resource Types @@ -15,13 +14,9 @@ This module deploys ServiceFabric Clusters ApplicationTypes. | :-- | :-- | :-- | :-- | :-- | | `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered | | `name` | string | `defaultApplicationType` | | Optional. Application type name. | -| `serviceFabricClusterName` | string | | | Required. Name of the Serivce Fabric cluster. | +| `serviceFabricClusterName` | string | | | Required. Name of the Service Fabric cluster. | | `tags` | object | `{object}` | | Optional. Tags of the resource. | -### Parameter Usage: `` - -// TODO: Fill in Parameter usage - ### Parameter Usage: `tags` Tag names and tag values can be provided as needed. A tag can be left without a value. diff --git a/arm/Microsoft.ServiceFabric/clusters/readme.md b/arm/Microsoft.ServiceFabric/clusters/readme.md index 3b21a52023..1892b63567 100644 --- a/arm/Microsoft.ServiceFabric/clusters/readme.md +++ b/arm/Microsoft.ServiceFabric/clusters/readme.md @@ -1,6 +1,6 @@ -# ServiceFabric Clusters `[Microsoft.ServiceFabric/clusters]` +# ServiceFabric Cluster `[Microsoft.ServiceFabric/clusters]` -This module deploys a service fabric cluster +This module deploys a service fabric cluster. ## Resource Types From 9ce1199932563e40afb1173def4766997f8543fd Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 11 Jan 2022 15:46:54 +0100 Subject: [PATCH 44/50] Minor update --- .../clusters/.parameters/full.parameters.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json index ace8e17d53..52ed79b1db 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json @@ -24,9 +24,9 @@ }, "azureActiveDirectory": { "value": { - "clientApplication": "e58511af-4da2-449c-a5cd-6a10271cfb83", + "clientApplication": "<>", "clusterApplication": "cf33fea8-b30f-424f-ab73-c48d99e0b222", - "tenantId": "449fbe1d-9c99-4509-9014-4fd5cf25b014" + "tenantId": "<>" } }, "certificateCommonNames": { @@ -189,7 +189,7 @@ { "roleDefinitionIdOrName": "Reader", "principalIds": [ - "e58511af-4da2-449c-a5cd-6a10271cfb83" + "<>" ] } ] From d0f831728827a9b84f6f3472afac93e7f812cb94 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 12 Jan 2022 21:08:04 +0100 Subject: [PATCH 45/50] Fixed endpoints --- .../clusters/.parameters/cert.parameters.json | 2 +- .../clusters/.parameters/full.parameters.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters.json index 94ba1ffdcb..03ff74b75d 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/cert.parameters.json @@ -6,7 +6,7 @@ "value": "sxx-az-sfc-cert-001" }, "managementEndpoint": { - "value": "https://sxx-az-sfc-min-001.westeurope.cloudapp.azure.com:19080" + "value": "https://sxx-az-sfc-cert-001.westeurope.cloudapp.azure.com:19080" }, "reliabilityLevel": { "value": "None" diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json index 52ed79b1db..48616f6d23 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json @@ -98,7 +98,7 @@ ] }, "managementEndpoint": { - "value": "https://sxx-az-sfc-weu-x-001.westeurope.cloudapp.azure.com:19080" + "value": "https://sxx-az-sfc-full-001.westeurope.cloudapp.azure.com:19080" }, "nodeTypes": { "value": [ From e25513fd0400acaaf1c3fe5d6e106278cbc8ef32 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 12 Jan 2022 21:09:12 +0100 Subject: [PATCH 46/50] Fixed tags --- .../clusters/.parameters/full.parameters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json index 48616f6d23..8b24b1895f 100644 --- a/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json +++ b/arm/Microsoft.ServiceFabric/clusters/.parameters/full.parameters.json @@ -8,7 +8,7 @@ "tags": { "value": { "resourceType": "Service Fabric", - "clusterName": "sxx-az-sfc-x-001" + "clusterName": "sxx-az-sfc-full-001" } }, "addOnFeatures": { From debe4a9b84728e551889a1dfae0a86465a5d50ac Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 14 Jan 2022 12:08:38 +0100 Subject: [PATCH 47/50] Removed dots --- arm/Microsoft.ServiceFabric/clusters/deploy.bicep | 2 +- arm/Microsoft.ServiceFabric/clusters/readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 2ee76ba87e..0e9141abaf 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -30,7 +30,7 @@ param addOnFeatures array = [] @description('Required. Number of unused versions per application type to keep.') param maxUnusedVersionsToKeep int = 3 -@description('Optional. The settings to enable AAD authentication on the cluster..') +@description('Optional. The settings to enable AAD authentication on the cluster.') param azureActiveDirectory object = {} @description('Optional. Describes the certificate details like thumbprint of the primary certificate, thumbprint of the secondary certificate and the local certificate store location') diff --git a/arm/Microsoft.ServiceFabric/clusters/readme.md b/arm/Microsoft.ServiceFabric/clusters/readme.md index 1892b63567..2ed5cb7fab 100644 --- a/arm/Microsoft.ServiceFabric/clusters/readme.md +++ b/arm/Microsoft.ServiceFabric/clusters/readme.md @@ -17,7 +17,7 @@ This module deploys a service fabric cluster. | :-- | :-- | :-- | :-- | :-- | | `addOnFeatures` | array | `[]` | `[BackupRestoreService, DnsService, RepairManager, ResourceMonitorService]` | Optional. The list of add-on features to enable in the cluster. | | `applicationTypes` | _[applicationTypes](applicationTypes/readme.md)_ array | `[]` | | Optional. Array of Service Fabric cluster application types. | -| `azureActiveDirectory` | object | `{object}` | | Optional. The settings to enable AAD authentication on the cluster.. | +| `azureActiveDirectory` | object | `{object}` | | Optional. The settings to enable AAD authentication on the cluster. | | `certificate` | object | `{object}` | | Optional. Describes the certificate details like thumbprint of the primary certificate, thumbprint of the secondary certificate and the local certificate store location | | `certificateCommonNames` | object | `{object}` | | Optional. Describes a list of server certificates referenced by common name that are used to secure the cluster. | | `clientCertificateCommonNames` | array | `[]` | | Optional. The list of client certificates referenced by common name that are allowed to manage the cluster. | From 631b5f3ed89bdca713df04e845e88018caffa6a6 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 25 Jan 2022 16:13:48 +0100 Subject: [PATCH 48/50] Updated to latest naming --- .../clusters/applicationTypes/deploy.bicep | 6 +++--- .../clusters/applicationTypes/readme.md | 6 +++--- arm/Microsoft.ServiceFabric/clusters/deploy.bicep | 8 ++++---- arm/Microsoft.ServiceFabric/clusters/readme.md | 12 ++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep index e9243896e6..dbc0d3b70a 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/deploy.bicep @@ -26,10 +26,10 @@ resource applicationTypes 'Microsoft.ServiceFabric/clusters/applicationTypes@202 } @description('The resource name of the Application type.') -output applicationTypeName string = applicationTypes.name +output name string = applicationTypes.name @description('The resource group of the Application type.') -output applicationTypeResourceGroup string = resourceGroup().name +output resourceGroupName string = resourceGroup().name @description('The resource ID of the Application type.') -output applicationTypeResourceID string = applicationTypes.id +output resourceID string = applicationTypes.id diff --git a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md index 1ec526025e..796bec35ef 100644 --- a/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md +++ b/arm/Microsoft.ServiceFabric/clusters/applicationTypes/readme.md @@ -38,9 +38,9 @@ Tag names and tag values can be provided as needed. A tag can be left without a | Output Name | Type | Description | | :-- | :-- | :-- | -| `applicationTypeName` | string | The resource name of the Application type. | -| `applicationTypeResourceGroup` | string | The resource group of the Application type. | -| `applicationTypeResourceID` | string | The resource ID of the Application type. | +| `name` | string | The resource name of the Application type. | +| `resourceGroupName` | string | The resource group of the Application type. | +| `resourceID` | string | The resource ID of the Application type. | ## Template references diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 0e9141abaf..9331510d08 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -301,13 +301,13 @@ module serviceFabricCluster_applicationTypes 'applicationTypes/deploy.bicep' = [ }] @description('The Service Fabric Cluster name.') -output clusterName string = serviceFabricCluster.name +output name string = serviceFabricCluster.name @description('The Service Fabric Cluster resource group.') -output clusterResourceGroup string = resourceGroup().name +output resourceGroupName string = resourceGroup().name @description('The Service Fabric Cluster resource ID.') -output clusterResourceId string = serviceFabricCluster.id +output resourceId string = serviceFabricCluster.id @description('The Service Fabric Cluster endpoint.') -output clusterEndpoint string = serviceFabricCluster.properties.clusterEndpoint +output endpoint string = serviceFabricCluster.properties.clusterEndpoint diff --git a/arm/Microsoft.ServiceFabric/clusters/readme.md b/arm/Microsoft.ServiceFabric/clusters/readme.md index 2ed5cb7fab..d9fd43170b 100644 --- a/arm/Microsoft.ServiceFabric/clusters/readme.md +++ b/arm/Microsoft.ServiceFabric/clusters/readme.md @@ -115,14 +115,14 @@ Tag names and tag values can be provided as needed. A tag can be left without a | Output Name | Type | Description | | :-- | :-- | :-- | -| `clusterEndpoint` | string | The Service Fabric Cluster endpoint. | -| `clusterName` | string | The Service Fabric Cluster name. | -| `clusterResourceGroup` | string | The Service Fabric Cluster resource group. | -| `clusterResourceId` | string | The Service Fabric Cluster resource ID. | +| `endpoint` | string | The Service Fabric Cluster endpoint. | +| `name` | string | The Service Fabric Cluster name. | +| `resourceGroupName` | string | The Service Fabric Cluster resource group. | +| `resourceId` | string | The Service Fabric Cluster resource ID. | ## Template references -- [Locks](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2016-09-01/locks) -- [Roleassignments](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-04-01-preview/roleAssignments) - [Clusters](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters) - [Clusters/Applicationtypes](https://docs.microsoft.com/en-us/azure/templates/Microsoft.ServiceFabric/2021-06-01/clusters/applicationTypes) +- [Locks](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2016-09-01/locks) +- [Roleassignments](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-04-01-preview/roleAssignments) From 751ee1a4c7d3d7934ed654699f3473ec1b8991e6 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 25 Jan 2022 16:20:37 +0100 Subject: [PATCH 49/50] Updated GH workflow to latest & added ADO pipeline --- .../ms.servicefabric.clusters.yml | 63 ++++++++++++++++ .../workflows/ms.servicefabric.clusters.yml | 73 +++++-------------- 2 files changed, 83 insertions(+), 53 deletions(-) create mode 100644 .azuredevops/modulePipelines/ms.servicefabric.clusters.yml diff --git a/.azuredevops/modulePipelines/ms.servicefabric.clusters.yml b/.azuredevops/modulePipelines/ms.servicefabric.clusters.yml new file mode 100644 index 0000000000..8e474d6696 --- /dev/null +++ b/.azuredevops/modulePipelines/ms.servicefabric.clusters.yml @@ -0,0 +1,63 @@ +name: 'Service Fabric - Clusters' + +parameters: + - name: removeDeployment + displayName: Remove deployed module + type: boolean + default: true + - name: versioningOption + displayName: The mode to handle the version increments [major|minor|patch] + type: string + default: patch + values: + - patch + - minor + - major + - name: customVersion + displayName: Custom version to apply. Used only if higher than latest + type: string + default: '0.0.1' + +trigger: + batch: true + branches: + include: + - main + paths: + include: + - '/.azuredevops/modulePipelines/ms.servicefabric.clusters.yml' + - '/.azuredevops/pipelineTemplates/module.*.yml' + - '/Microsoft.ServiceFabric/clusters/*' + exclude: + - '/**/*.md' + +variables: + - template: '/.azuredevops/pipelineVariables/global.variables.yml' + - group: 'PLATFORM_VARIABLES' + - name: modulePath + value: '/arm/Microsoft.ServiceFabric/clusters' + +stages: + - stage: Validation + displayName: Pester tests + jobs: + - template: /.azuredevops/pipelineTemplates/module.jobs.validate.yml + + - stage: Deployment + displayName: Deployment tests + jobs: + - template: /.azuredevops/pipelineTemplates/module.jobs.deploy.yml + parameters: + removeDeployment: '${{ parameters.removeDeployment }}' + deploymentBlocks: + - path: $(modulePath)/.parameters/min.parameters.json + - path: $(modulePath)/.parameters/parameters.json + + - stage: Publishing + displayName: Publish module + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) + jobs: + - template: /.azuredevops/pipelineTemplates/module.jobs.publish.yml + parameters: + versioningOption: '${{ parameters.versioningOption }}' + customVersion: '${{ parameters.customVersion }}' diff --git a/.github/workflows/ms.servicefabric.clusters.yml b/.github/workflows/ms.servicefabric.clusters.yml index 13d6f14b04..0fca4bf2c6 100644 --- a/.github/workflows/ms.servicefabric.clusters.yml +++ b/.github/workflows/ms.servicefabric.clusters.yml @@ -29,6 +29,8 @@ on: - '.github/workflows/ms.servicefabric.clusters.yml' - 'arm/Microsoft.ServiceFabric/clusters/**' - '!*/**/readme.md' + - 'utilities/pipelines/**' + - '!utilities/pipelines/dependencies/**' env: modulePath: 'arm/Microsoft.ServiceFabric/clusters' @@ -61,49 +63,31 @@ jobs: versioningOption: ${{ steps.get-workflow-param.outputs.versioningOption }} customVersion: ${{ steps.get-workflow-param.outputs.customVersion }} - ################## - # UNIT TESTS # - ################## - # Global tests - # ------------ - job_tests_module_global: + #################### + # Pester Tests # + #################### + job_module_pester_validation: runs-on: ubuntu-20.04 - name: 'Run global module tests' + name: 'Pester tests' steps: - name: 'Checkout' uses: actions/checkout@v2 with: fetch-depth: 0 - - name: 'Test module' - uses: ./.github/actions/templates/validateModuleGeneral + - name: 'Run tests' + uses: ./.github/actions/templates/validateModulePester with: modulePath: '${{ env.modulePath }}' - # Global API tests - # ---------------- - job_tests_module_global_api: - runs-on: ubuntu-20.04 - name: 'Run global API module tests' - steps: - - name: 'Checkout' - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: 'Test module' - uses: ./.github/actions/templates/validateModuleApis - with: - modulePath: '${{ env.modulePath }}' - - ########################### - # Deployment module tests # - ########################### + #################### + # Deployment tests # + #################### job_module_deploy_validation: runs-on: ubuntu-20.04 - name: 'Run deployment validation module tests' + name: 'Deployment tests' needs: - job_set_workflow_param - - job_tests_module_global - - job_tests_module_global_api + - job_module_pester_validation strategy: fail-fast: false matrix: @@ -116,26 +100,9 @@ jobs: - name: Set environment variables uses: deep-mm/set-variables@v1.0 with: - # Name of variable file - variableFileName: 'variables.module' # Don't write .json here - # ----------- # - ## Dry Run ## - # ----------- # - - name: 'Test module with parameter file [${{ matrix.parameterFilePaths }}]' - uses: ./.github/actions/templates/validateModuleDeploy - with: - templateFilePath: '${{ env.modulePath }}/deploy.bicep' - parameterFilePath: '${{ env.modulePath }}/.parameters/${{ matrix.parameterFilePaths }}' - location: '${{ env.defaultLocation }}' - resourceGroupName: '${{ env.resourceGroupName }}' - subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' - managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}' - # ------------------- # - ## Deploy & Remove ## - # ------------------- # - - name: 'Deploy module with parameter file [${{ matrix.parameterFilePaths }}]' - id: step_deploy - uses: ./.github/actions/templates/deployModule + variableFileName: 'global.variables' + - name: 'Using parameter file [${{ matrix.parameterFilePaths }}]' + uses: ./.github/actions/templates/validateModuleDeployment with: templateFilePath: '${{ env.modulePath }}/deploy.bicep' parameterFilePath: '${{ env.modulePath }}/.parameters/${{ matrix.parameterFilePaths }}' @@ -150,7 +117,7 @@ jobs: ############### job_publish_module: name: 'Publish module' - if: contains(fromJson('["refs/heads/main", "refs/heads/master"]'), github.ref) + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' runs-on: ubuntu-20.04 needs: - job_set_workflow_param @@ -163,8 +130,7 @@ jobs: - name: Set environment variables uses: deep-mm/set-variables@v1.0 with: - # Name of variable file - variableFileName: 'variables.module' # Don't write .json here + variableFileName: 'global.variables' - name: 'Publish module' uses: ./.github/actions/templates/publishModule with: @@ -177,4 +143,5 @@ jobs: templateSpecsDoPublish: '${{ env.templateSpecsDoPublish }}' bicepRegistryName: '${{ env.bicepRegistryName }}' bicepRegistryRGName: '${{ env.bicepRegistryRGName }}' + bicepRegistryRgLocation: '${{ env.bicepRegistryRgLocation }}' bicepRegistryDoPublish: '${{ env.bicepRegistryDoPublish }}' From 9927ed6037245710cba0d44be95fbee7c5e57c13 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 25 Jan 2022 16:25:06 +0100 Subject: [PATCH 50/50] Minor update --- arm/Microsoft.ServiceFabric/clusters/deploy.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep index 9331510d08..e3f8499680 100644 --- a/arm/Microsoft.ServiceFabric/clusters/deploy.bicep +++ b/arm/Microsoft.ServiceFabric/clusters/deploy.bicep @@ -167,7 +167,7 @@ var nodeTypes_var = [for nodeType in nodeTypes: { isPrimary: contains(nodeType, 'isPrimary') ? nodeType.isPrimary : null isStateless: contains(nodeType, 'isStateless') ? nodeType.isStateless : null multipleAvailabilityZones: contains(nodeType, 'multipleAvailabilityZones') ? nodeType.multipleAvailabilityZones : null - name: !empty(nodeType.name) ? nodeType.name : 'Node00' + name: contains(nodeType, 'name') ? nodeType.name : 'Node00' placementProperties: contains(nodeType, 'placementProperties') ? nodeType.placementProperties : null reverseProxyEndpointPort: contains(nodeType, 'reverseProxyEndpointPort') ? nodeType.reverseProxyEndpointPort : null vmInstanceCount: contains(nodeType, 'vmInstanceCount') ? nodeType.vmInstanceCount : 1