Obs/bin/ObsDep/content/Configuration/Role.xml

<?xml version="1.0" encoding="utf-8"?>
<Role Id="ObservabilityConfig" NugetName="Microsoft.AzureStack.Observability.ObservabilityDeployment" PSClass="content\Powershell\ObservabilityConfig.psm1" xmlns:pp="http://schemas.microsoft.com/ece/2015/preprocessor">
  <PrivateInfo>
    <Accounts>
      <BuiltInAdminAccountID>LocalAdmin</BuiltInAdminAccountID>
      <DomainUserAccountID>DomainAdmin</DomainUserAccountID>
      <RegistrationTokenCacheID>RegistrationTokenCache</RegistrationTokenCacheID>
      <RegistrationSPID>RegistrationSP</RegistrationSPID>
    </Accounts>
  </PrivateInfo>
  <PublicInfo>
    <StreamingDataClient>[STREAMINGDATACLIENT]</StreamingDataClient>
    <EpisodicDataUpload>[EPISODICDATAUPLOAD]</EpisodicDataUpload>
    <GMACacheFolderName>GMACache</GMACacheFolderName>
    <Volumes>
      <Host>
        <PhysicalDriveLetter>[PhysicalDriveLetter]</PhysicalDriveLetter>
        <ObservabilityDriveFileName>Observability.vhdx</ObservabilityDriveFileName>
        <ObservabilityDriveAccessPath Path="$env:SystemDrive\Observability" />
        <ObservabilityDriveSizeInBytes>[ObservabilityDriveSizeInBytes]</ObservabilityDriveSizeInBytes>
        <ObservabilityVolumeLabel>ObservabilityVolume</ObservabilityVolumeLabel>
        <ObservabilitySubFolderConfigFileName>ObservabilityFoldersHost.json</ObservabilitySubFolderConfigFileName>
      </Host>
      <NC>
        <ObservabilityDriveFileName>Observability.vhdx</ObservabilityDriveFileName>
        <ObservabilityDriveAccessPath Path="$env:SystemDrive\Observability" />
        <ObservabilityDriveSizeInBytes>64424509440</ObservabilityDriveSizeInBytes>
        <ObservabilityVolumeLabel>ObservabilityVolume</ObservabilityVolumeLabel>
        <ObservabilitySubFolderConfigFileName>ObservabilityFoldersNC.json</ObservabilitySubFolderConfigFileName>
      </NC>
    </Volumes>
    <FolderQuotaCleanupThresholdInPercent>90</FolderQuotaCleanupThresholdInPercent>
    <FolderQuotaFreeSpaceThresholdInPercent>80</FolderQuotaFreeSpaceThresholdInPercent>
    <PurgeFolderFrequencyInMinutes>10</PurgeFolderFrequencyInMinutes>
    <EventSources>
      <EventSource>
        <EventSourceRootName>Microsoft.AzureStack.Observability.ObservabilityDeployment.Microsoft-AzureStack-Observability.etwManifest</EventSourceRootName>
        <EventSourceLogName>Microsoft-AzureStack-Observability/Operational</EventSourceLogName>
        <EventSourcePublisher>Microsoft-AzureStack-Observability</EventSourcePublisher>
        <EventSourceLogSizeInBytes>16777216</EventSourceLogSizeInBytes> <!--16MB for Observability/Operational evtx file-->
      </EventSource>
      <EventSource>
        <EventSourceRootName>Microsoft.AzureStack.Observability.ObservabilityDeployment.Microsoft-AzureStack-Observability-ClusterPerf.etwManifest</EventSourceRootName>
        <EventSourceLogName>Microsoft-AzureStack-Observability-ClusterPerf/Operational</EventSourceLogName>
        <EventSourcePublisher>Microsoft-AzureStack-Observability-ClusterPerf</EventSourcePublisher>
        <EventSourceLogSizeInBytes>16777216</EventSourceLogSizeInBytes>
      </EventSource>
      <EventSource>
        <EventSourceRootName>Microsoft.AzureStack.Observability.ObservabilityDeployment.Microsoft-AzureStack-Observability-Census.etwManifest</EventSourceRootName>
        <EventSourceLogName>Microsoft-AzureStack-Observability-Census/Operational</EventSourceLogName>
        <EventSourcePublisher>Microsoft-AzureStack-Observability-Census</EventSourcePublisher>
        <EventSourceLogSizeInBytes>16777216</EventSourceLogSizeInBytes>
      </EventSource>
    </EventSources>
  </PublicInfo>
  <Actions>
    <!-- ArcA currently does not support Arc4Server, skip Observability feature for ArcA deployment -->
    <Action Type="EvaluateSetupObservability" EceErrorAction="Stop">
      <Steps>
          <Step Index="0" Name="Evaluate SetupObservability" Description="Evaluate SetupObservability or skip it for ArcA.">
            <Task ActionType="CustomAction">
              <!-- Expand as either SetupObservability or Skip depending on evaluation. -->
              <Evaluation>
                <Task RolePath="ObservabilityConfig" InterfaceType="EvaluateSetupObservability" />
              </Evaluation>
            </Task>
          </Step>
      </Steps>
    </Action>
    <Action Type="SetupObservability">
      <Steps>
          <Step Index="0" Name="Register Observability EventSource" Description="Register Observability EventSource with Windows.">
            <Task RolePath="ObservabilityConfig" InterfaceType="RegisterObservabilityEventSource" />
          </Step>
          <Step Index="1" Name="Setup Observability Volume" Description="Create and set up Observability volume on hosts.">
            <Task RolePath="ObservabilityConfig" InterfaceType="CreateObservabilityVolume" />
          </Step>
          <Step Index="2" Name="Create Observability Subfolders and Volume Pruner" Description="Create volume subfolders and volume pruner.">
            <Task RolePath="ObservabilityConfig" InterfaceType="CreateVolumeFoldersAndPruner" />
          </Step>
          <Step Index="3" Name="Setup UTC Exporter Feature" Description="Set up AzureStack stamp to enable the UTC Exporter Feature.">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetUpUtcExporterFeature" />
          </Step>
          <Step Index="4" Name="Install VC Redistributable" Description="Install VC runtime on all hosts.">
            <Task RolePath="ObservabilityConfig" InterfaceType="InstallVcRuntime" />
          </Step>
          <Step Index="5" Name="Setup uptime scheduled task" Description="Setup uptime scheduled task.">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetUptimeScheduledTask" />
          </Step>
          <Step Index="6" Name="Setup census event scheduled task" Description="Setup the census event scheduled task to gather census events.">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetCensusEventScheduledTask" />
          </Step>
          <Step Index="7" Name="Setup registration events task" Description="Setup the one-time registration events task to get cluster and Arc registration events.">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetRegistrationEventOneTimeTask" />
          </Step>
          <Step Index="8" Name="Set DeviceType Registry Key" Description="Set registry key HKLM\Software\Microsoft\AzureStack DeviceType to AzureEdge.">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetDeviceTypeRegistryKey" />
          </Step>
      </Steps>
    </Action>
    <Action Type="SetupObservabilityPNU">
      <Steps>
          <Step Index="0" Name="Create Observability Subfolders and Volume Pruner" Description="Create volume subfolders and volume pruner.">
            <Task RolePath="ObservabilityConfig" InterfaceType="CreateVolumeFoldersAndPruner" />
          </Step>
          <Step Index="1" Name="Setup UTC Exporter Feature" Description="Set up AzureStack stamp to enable the UTC Exporter Feature.">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetUpUtcExporterFeature" />
          </Step>
          <Step Index="2" Name="Install VC Redistributable" Description="Install VC runtime on all hosts.">
            <Task RolePath="ObservabilityConfig" InterfaceType="InstallVcRuntime" />
          </Step>
          <Step Index="3" Name="Setup uptime scheduled task" Description="Setup uptime scheduled task.">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetUptimeScheduledTask" />
          </Step>
          <Step Index="4" Name="Setup census event scheduled task" Description="Setup the census event scheduled task to gather census events.">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetCensusEventScheduledTask" />
          </Step>
          <Step Index="5" Name="Setup registration events task" Description="Setup the one-time registration events task to get cluster and Arc registration events.">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetRegistrationEventOneTimeTask" />
          </Step>
      </Steps>
    </Action>
    <Action Type="SetupArcAgentPNU">
      <Steps>
          <PerNode RolePath="Cloud\Infrastructure\BareMetal" RoleName="BareMetal" Mode="Parallel">
            <Step Index="0" Name="Setup Arc Agent" Description="Update Arc Agent or install it in new nodes">
              <Task RolePath="ObservabilityConfig" InterfaceType="SetupArcAgent">
                <RemoteConfig NodeType="ExecutionContextNode" NodeRolePath="Cloud\Infrastructure\BareMetal" />
              </Task>
            </Step>
          </PerNode>
          <Step Index="1" Name="Connect Arc Agent" Description="Connect Arc Agents in all nodes">
            <Task RolePath="ObservabilityConfig" InterfaceType="ConnectArcAgent" />
          </Step>
          <Step Index="2" Name="Install Remote Support extension" Description="Installs Remote Support extension on all nodes.">
            <Task RolePath="ObservabilityConfig" InterfaceType="InstallRemoteSupportArcExtension"/>
          </Step>
      </Steps>
    </Action>
    <Action Type="PostOSUpdateObservabilitySetup">
      <Steps>
        <Step Index="0" Name="Setup UTC Exporter Feature" Description="Set up AzureStack stamp to enable the UTC Exporter Feature.">
          <Task RolePath="ObservabilityConfig" InterfaceType="SetUpUtcExporterFeature" />
        </Step>
        <Step Index="1" Name="Set GMATenantJsonRegistryKeys" Description="Set registry keys necessary for GMA Tenant config generation.">
          <Task RolePath="ObservabilityConfig" InterfaceType="SetGMATenantJsonRegistryKeys" />
        </Step>
        <PerNode RolePath="Cloud\Infrastructure\BareMetal" RoleName="BareMetal" Mode="Parallel">
          <Step Index="2" Name="Regenerate GMA Tenant Json files" Description="Regenerate GMA tenant json files based on registry key values.">
            <Task RolePath="ObservabilityConfig" InterfaceType="RegenerateGMATenantJsonFiles">
              <RemoteConfig NodeType="ExecutionContextNode" NodeRolePath="Cloud\Infrastructure\BareMetal" />
            </Task>
          </Step>
        </PerNode>
        <PerNode RolePath="Cloud\Infrastructure\BareMetal" RoleName="BareMetal" Mode="Parallel">
          <Step Index="3" Name="Restore MAWatchdog RegKey and Service" Description="If MAWatchdog regkey has been wiped, restore it and restart the Watchdog agent.">
            <Task RolePath="ObservabilityConfig" InterfaceType="RestoreMAWatchdogRegKeyAndService">
              <RemoteConfig NodeType="ExecutionContextNode" NodeRolePath="Cloud\Infrastructure\BareMetal" />
            </Task>
          </Step>
        </PerNode>
      </Steps>
    </Action>
    <Action Type="SetupObservabilityNC">
      <Steps>
        <Step Index="0" Name="Register Observability EventSource on NC VMs" Description="Register Observability EventSources on NC VMs with Windows.">
            <Task RolePath="ObservabilityConfig" InterfaceType="RegisterObservabilityEventSourceOnNC" />
        </Step>
        <PerNode RolePath="Cloud\Infrastructure\BareMetal" RoleName="BareMetal" Mode="Parallel">
          <Step Index="1" Name="Setup Observability Volume on NC VMs" Description="Create and set up Observability volume on NC VMs.">
            <Task RolePath="ObservabilityConfig" InterfaceType="CreateObservabilityVolumeOnNC">
              <RemoteConfig NodeType="ExecutionContextNode" NodeRolePath="Cloud\Infrastructure\BareMetal" />
            </Task>
          </Step>
        </PerNode>
      </Steps>
    </Action>
    <Action Type="SetObservabilityVolumeFolderQuotas">
      <Steps>
        <Step Index="0" Name="Setup Observability Volume Folder quotas" Description="Create and set up Observability Volume FSRM Quotas.">
          <Task RolePath="ObservabilityConfig" InterfaceType="SetFolderQuotas"/>
        </Step>
      </Steps>
    </Action>
    <!-- ArcA currently does not support Arc4Server, skip Observability feature for ArcA deployment -->
    <Action Type="EvaluateInstallBootstrapObservability" EceErrorAction="Stop">
      <Steps>
          <Step Index="0" Name="Evaluate InstallBootstrapObservability" Description="Evaluate InstallBootstrapObservability or skip it for ArcA.">
            <Task ActionType="CustomAction">
              <!-- Expand as either InstallBootstrapObservability or Skip depending on evaluation. -->
              <Evaluation>
                <Task RolePath="ObservabilityConfig" InterfaceType="EvaluateInstallBootstrapObservability" />
              </Evaluation>
            </Task>
          </Step>
      </Steps>
    </Action>
    <Action Type="InstallBootstrapObservability" EceErrorAction="Stop">
      <Steps>
        <Step Index="0" Name="Set DeviceType Registry Key" Description="Set registry key HKLM\Software\Microsoft\AzureStack DeviceType to AzureEdge.">
          <Task RolePath="ObservabilityConfig" InterfaceType="SetDeviceTypeRegistryKey" />
        </Step>
        <Step Index="1" Name="Set GMATenantJsonRegistryKeys" Description="Set registry keys necessary for GMA Tenant config generation.">
          <Task RolePath="ObservabilityConfig" InterfaceType="SetGMATenantJsonRegistryKeys" />
        </Step>
        <Step Index="2" Name="Install Arc for server agent and Observability extension" Description="Installs and connects arc for server agent and Observability extension on all nodes.">
          <Task RolePath="ObservabilityConfig" InterfaceType="InstallBootstrapObservability"/>
        </Step>
        <Step Index="3" Name="Install Remote Support extension" Description="Installs Remote Support extension on all nodes.">
          <Task RolePath="ObservabilityConfig" InterfaceType="InstallRemoteSupportArcExtension"/>
        </Step>
      </Steps>
    </Action>
    <Action Type="UninstallBootstrapObservability" EceErrorAction="Stop">
      <Steps>
        <Step Index="0" Name="Switch Observability Watchdog to Listener mode" Description="Sets WatchdogListenerMode registry key to 1 and waits for Watchdog managed processes to stop.">
          <Task RolePath="ObservabilityConfig" InterfaceType="SetWatchdogToListenerMode" />
        </Step>
        <Step Index="1" Name="Stop Arc Extension Observability Agent" Description="Stop and unregister the Arc Extension Observability Agent Windows Service.">
          <Task RolePath="ObservabilityConfig" InterfaceType="StopArcExtensionObservabilityAgent" />
        </Step>
      </Steps>
    </Action>
    <Action Type="SetWatchdogToListenerMode" EceErrorAction="Stop">
      <Steps>
        <Step Index="0" Name="Evaluate GMA Configuration type" Description="Evaluates whether GMA should be deployed per node or just on the node provided in the execution context" EceErrorAction="Stop">
          <Task ActionType="CustomAction">
            <!-- Expand as either SetListenerModeOnAllNodes or SetListenerModeOnOneNode depending on evaluation. -->
            <Evaluation>
              <Task RolePath="ObservabilityConfig" InterfaceType="EvaluateListenerModeConfigurationType" />
            </Evaluation>
          </Task>
        </Step>
      </Steps>
    </Action>
    <Action Type="SetListenerModeOnAllNodes" EceErrorAction="Stop">
      <Steps>
        <PerNode RolePath ="Cloud\Infrastructure\BareMetal" RoleName="BareMetal" Mode="Parallel">
          <Step Index="0" Name="Stop Env Checker and Arc Extension Remote Support Agent" Description="Stop and unregister the Env Checker and Arc Extension Remote Support Agent Windows Service.">
            <Task RolePath="ObservabilityConfig" InterfaceType="StopRemSupAgent" />
          </Step>
        </PerNode>
      </Steps>
    </Action>
    <Action Type="SetListenerModeOnOneNode" EceErrorAction="Stop">
      <Steps>
        <Step Index="0" Name="Stop Env Checker and Arc Extension Remote Support Agent" Description="Stop and unregister the Env Checker and Arc Extension Remote Support Agent Windows Service.">
          <Task RolePath="ObservabilityConfig" InterfaceType="StopRemSupAgent" />
        </Step>
      </Steps>
    </Action>
    <Action Type="EvaluateSendTelemetryFromCachedFiles" EceErrorAction="Stop">
      <Steps>
          <Step Index="0" Name="Evaluate SendTelemetryFromCachedFiles" Description="Evaluate SendTelemetryFromCachedFiles or skip it for ArcA.">
            <Task ActionType="CustomAction">
              <!-- Expand as either SendTelemetryFromCachedFiles or Skip depending on evaluation. -->
              <Evaluation>
                <Task RolePath="ObservabilityConfig" InterfaceType="EvaluateSendTelemetryFromCachedFiles" />
              </Evaluation>
            </Task>
          </Step>
      </Steps>
    </Action>
    <Action Type="SendTelemetryFromCachedFiles" EceErrorAction="SilentlyContinue">
      <Steps>
        <Step Index="0" Name="Send Telemetry from cached files" Description="Send Telemetry from cached files to cover 1P.">
          <Task RolePath="ObservabilityConfig" InterfaceType="GenerateTelemetryFromCachedFiles"/>
        </Step>
      </Steps>
    </Action>
    <!-- ArcA currently does not support Arc4Server, skip Observability feature for ArcA deployment -->
    <Action Type="EvaluatePostRegistrationObservabilitySetup" EceErrorAction="Stop">
      <Steps>
          <Step Index="0" Name="Evaluate PostRegistrationObservabilitySetup" Description="Evaluate PostRegistrationObservabilitySetup or skip it for ArcA.">
            <Task ActionType="CustomAction">
              <!-- Expand as either PostRegistrationObservabilitySetup or Skip depending on evaluation. -->
              <Evaluation>
                <Task RolePath="ObservabilityConfig" InterfaceType="EvaluatePostRegistrationObservabilitySetup" />
              </Evaluation>
            </Task>
          </Step>
      </Steps>
    </Action>
    <Action Type="PostRegistrationObservabilitySetup" EceErrorAction="Stop">
      <Steps>
        <Step Index="0" Name="Sync Diagnostic Level" Description="Sync diagnostic level">
          <Task RolePath="ObservabilityConfig" InterfaceType="SyncDiagnosticLevel"/>
        </Step>
        <PerNode RolePath ="Cloud\Infrastructure\BareMetal" RoleName="BareMetal" Mode="Parallel">
          <Step Index="1" Name="Update TenantJson NodeId and AssemblyBuild" Description="Update NodeId and AssemblyBuild registry values and regenerate tenant json files">
            <Task RolePath="ObservabilityConfig" InterfaceType="UpdateGMATenantJsonNodeId"/>
          </Step>
        </PerNode>
      </Steps>
    </Action>
    <Action Type="RemoveObservabilityAgents" EceErrorAction="Stop">
      <Steps>
        <PerNode RolePath ="Cloud\Infrastructure\BareMetal" RoleName="BareMetal" Mode="Parallel">
          <Step Index="0" Name="Removes Observability Agents from ALM Lists" Description="Removes Observability agents from ALM Agent lists.">
            <Task RolePath="Cloud\Fabric\AgentLifecycleManager" InterfaceType="RemoveObsAgents" >
              <RemoteConfig NodeType="ExecutionContextNode" NodeRolePath="Cloud\Infrastructure\BareMetal" />
            </Task>
          </Step>
          <Step Index="1" Name="Delete Observability Agents" Description="Stop and unregister existing observability agents">
            <Task RolePath="ObservabilityConfig" InterfaceType="DeleteObservabilityAgents">
              <RemoteConfig NodeType="ExecutionContextNode" NodeRolePath="Cloud\Infrastructure\BareMetal" />
            </Task>
          </Step>
          <Step Index="2" Name="Set Observability Listener Mode Off" Description="Set Observability Watchdog listener mode registry key to 0">
            <Task RolePath="ObservabilityConfig" InterfaceType="SetListenerModeOff">
              <RemoteConfig NodeType="ExecutionContextNode" NodeRolePath="Cloud\Infrastructure\BareMetal" />
            </Task>
          </Step>
          <Step Index="3" Name="Start Arc Extension Observability Agent" Description="Register and start Arc Extension Observabilty Agent">
            <Task RolePath="ObservabilityConfig" InterfaceType="StartArcExtensionObsAgent">
              <RemoteConfig NodeType="ExecutionContextNode" NodeRolePath="Cloud\Infrastructure\BareMetal" />
            </Task>
          </Step>
        </PerNode>
      </Steps>
    </Action>
  </Actions>
</Role>