Search code examples
azure-service-fabric

What environment variables are available to the SetupEntryPoint process?


I'm looking to write a script to execute as a SetupEntryPoint for a Service Fabric Service. I'd like to know what environment variables would be available to the process.

The environment variables available to a running service are documented here. The documentation for SetupEntryPoint may be found here but does not elude to what environment variables are available to the process.


Solution

  • I wrote the following simple batch file to run as the SetupEntryPoint of my service, which dumps all environment variables available to the process to temporary file:

    powershell.exe -NonInteractive -Command "& { Get-ChildItem 'env:*' | Sort-Object name | Format-Table -Wrap | Out-File 'C:/Windows/Temp/EnvVariables.txt' }"
    

    After I re-deployed my test Service Fabric application, the following variables related to Service Fabric were identified (I've omitted the values for security purposes):

    Fabric_ApplicationHostId  
    Fabric_ApplicationHostType
    Fabric_ApplicationId 
    Fabric_ApplicationName 
    Fabric_CodePackageInstanceSeqNum
    Fabric_CodePackageName
    Fabric_Endpoint_IPOrFQDN_RemotingEndpoint
    Fabric_Endpoint_RemotingEndpoint
    Fabric_Folder_App_Log          
    Fabric_Folder_App_Temp         
    Fabric_Folder_App_Work         
    Fabric_Folder_Application      
    Fabric_Folder_Application_OnHost                             
    Fabric_IsCodePackageActivatorHost
    Fabric_IsContainerHost         
    Fabric_NodeId                  
    Fabric_NodeIPOrFQDN            
    Fabric_NodeName                
    Fabric_PartitionId             
    Fabric_RuntimeConnectionAddress
    Fabric_RuntimeSslConnectionAddress
    Fabric_RuntimeSslConnectionCertEncodedBytes
    Fabric_RuntimeSslConnectionCertKey
    Fabric_RuntimeSslConnectionCertThumbprint
    Fabric_ServiceName
    Fabric_ServicePackageActivationGuid
    Fabric_ServicePackageActivationId
    Fabric_ServicePackageInstanceSeqNum
    Fabric_ServicePackageName
    Fabric_ServicePackageVersionInstance
    FabricActivatorAddress
    FabricPackageFileName
    HostedServiceName
    

    Many of these can be cross-referenced with the documentation here. It would still be nice if these were officially documented somewhere specifically related to the SetupEntryPoint.