Get-ServiceFabricDeployedApplication
Gets the Service Fabric application(s) on a specified node.
Syntax
Get-ServiceFabricDeployedApplication
[-NodeName] <String>
[[-ApplicationName] <Uri>]
[-UsePaging]
[-GetSinglePage]
[-IncludeHealthState]
[-MaxResults <Int64>]
[-ContinuationToken <String>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Get-ServiceFabricDeployedApplication
[-NodeName] <String>
[[-ApplicationName] <Uri>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Description
The Get-ServiceFabricDeployedApplication cmdlet gets the Service Fabric application(s) deployed on a specified node.
Service Fabric creates work, log, and temporary directories on the node for each deployed application. Because the directory names include the application ID, the directory names cannot be guessed. When the DeployedApplicationStatus is Active, Get-ServiceFabricDeployedApplication returns the directory names in the WorkDirectory, LogDirectory, and TempDirectory return values. When the DeployedApplicationStatus is Downloading, the WorkDirectory, LogDirectory, and TempDirectory values are null.
The deployed application services store their persisted data in the WorkDirectory. For debugging or diagnostic purposes a different application or process may need to know the location of the WorkDirectory.
The deployed application services should store their log in the LogDirectory created by Service Fabric. A custom uploader of the log files may need to know the location. The location of the LogDirectory may be needed for diagnostic purposes as well when an application on a particular node is not working as expected.
By default, this query returns a number of results limited to the max message size configuration. SDKs and clusters versions 6.1 or newer supports paging functionality which removes this restriction; the new behavior will be to return the results regardless of max message size configuration because this query loops through all returned pages transparently. To use paging and other new functionalities, see the parameter set "UsePagedAPI". Selecting any new filters signals to the query to use paging under the hood. Otherwise, select "UsePaging" to opt into paged querying.
Before you perform any operation on a Service Fabric cluster, establish a connection to the cluster by using the Connect-ServiceFabricCluster cmdlet.
Examples
Example 1: Get application "fabric:/samples/CalcApp2"
PS C:\> Get-ServiceFabricDeployedApplication -NodeName "VIPULM4-RK01-BD01" -ApplicationName fabric:/samples/CalcApp2
ApplicationName : fabric:/samples/CalcApp2
ApplicationTypeName : CalculatorApp
DeployedApplicationStatus : Active
WorkDirectory : D:\ServiceFabric\Data\VIPULM4-RK01-BD01\Fabric\work\Applications\CalculatorApp_App5\work
LogDirectory : D:\ServiceFabric\Data\VIPULM4-RK01-BD01\Fabric\work\Applications\CalculatorApp_App5\log
TempDirectory : D:\ServiceFabric\Data\VIPULM4-RK01-BD01\Fabric\work\Applications\CalculatorApp_App5\temp
HealthState : Unknown
This command returns deployed applications. In this example, the DeployedApplicationStatus is Active, and, therefore, Get-ServiceFabricDeployedApplication returns the directory names in the WorkDirectory, LogDirectory, and TempDirectory return values.
Example 2: Get application "fabric:/samples/VQueueApp2"
PS C:\> Get-ServiceFabricDeployedApplication -NodeName VIPULM4-RK01-BD01 fabric:/samples/VQueueApp2
ApplicationName : fabric:/samples/VQueueApp2
ApplicationTypeName : VolatileQueueApp
DeployedApplicationStatus : Downloading
HealthState : Unknown
This command returns deployed applications. In this example, the DeployedApplicationStatus is Downloading, and, therefore, the command returns values of null for WorkDirectory, LogDirectory, and TempDirectory.
Example 3: Get application(s) with max results
PS C:\>Get-ServiceFabricDeployedApplication -NodeName _Node_1 -MaxResults 2 -GetSinglePage -Verbose
ApplicationName : fabric:/samples/CalculatorApp
ApplicationTypeName : CalculatorApp
DeployedApplicationStatus : Active
WorkDirectory : C:\SfDevCluster\Data\_App\_Node_1\CalculatorApp_App0\work
LogDirectory : C:\SfDevCluster\Data\_App\_Node_1\CalculatorApp_App0\log
TempDirectory : C:\SfDevCluster\Data\_App\_Node_1\CalculatorApp_App0\temp
HealthState : Unknown
ApplicationName : fabric:/samples/PQueueApp1
ApplicationTypeName : PersistentQueueApp
DeployedApplicationStatus : Active
WorkDirectory : C:\SfDevCluster\Data\_App\_Node_1\PersistentQueueApp_App1\work
LogDirectory : C:\SfDevCluster\Data\_App\_Node_1\PersistentQueueApp_App1\log
TempDirectory : C:\SfDevCluster\Data\_App\_Node_1\PersistentQueueApp_App1\temp
HealthState : Unknown
VERBOSE: Continuation Token: fabric:/samples/PQueueApp1
This command gets all the Service Fabric application(s) deployed on the provided node in the cluster which fit onto a page. The size of the page is further limited to two items, as configured by the MaxResults parameter. Because we selected the "GetSinglePage" option, this query will return only one page of results. MaxResults cannot be used without this option. Selecting "Verbose" prints the returned continuation token value. This value can be used in a subsequent query to get the next page of results. You can also access the returned continuation token by saving the returned results and accessing the "ContinuationToken" property. The "ContinuationToken" property is null is there is no returned continuation token.
Example 4: Get application with continuation token
PS C:\>Get-ServiceFabricDeployedApplication -NodeName _Node_1 -ContinuationToken fabric:/samples/PQueueApp1 -UsePaging
ApplicationName : fabric:/samples/VQueueApp1
ApplicationTypeName : VolatileQueueApp
DeployedApplicationStatus : Active
WorkDirectory : C:\SfDevCluster\Data\_App\_Node_1\VolatileQueueApp_App2\work
LogDirectory : C:\SfDevCluster\Data\_App\_Node_1\VolatileQueueApp_App2\log
TempDirectory : C:\SfDevCluster\Data\_App\_Node_1\VolatileQueueApp_App2\temp
HealthState : Unknown
This command gets the Service Fabric application(s) which respect the provided continuation token which fit into a single page. The continuation token provided to this query is the same one returned from the example above. In this example cluster, there is only one item which respects the continuation token. If there are too many applications which respect the provided continuation token on the node to fit into one page of results, then this query configuration will return a compilation of all returned pages, looping through them transparently; the query will then return a vector of all the results. To get only one page of results, select the "GetSinglePage" option.
Example 5: Get application with health state
PS C:\>Get-ServiceFabricDeployedApplication -NodeName _Node_1 -ApplicationName fabric:/samples/CalculatorApp -IncludeHealthState
ApplicationName : fabric:/samples/CalculatorApp
ApplicationTypeName : CalculatorApp
DeployedApplicationStatus : Active
WorkDirectory : C:\SfDevCluster\Data\_App\_Node_1\CalculatorApp_App0\work
LogDirectory : C:\SfDevCluster\Data\_App\_Node_1\CalculatorApp_App0\log
TempDirectory : C:\SfDevCluster\Data\_App\_Node_1\CalculatorApp_App0\temp
HealthState : Ok
This command gets the Service Fabric application which matches the provided application name and includes its health state.
Parameters
-ApplicationName
Specifies the Uniform Resource Identifier (URI) of a Service Fabric application. The cmdlet gets the deployed application that matches the specified application name. This query does an exact match. For example, the URI fabric:/App will not match fabric:/App1. At most one result will be returned if the application name is provided. If the provided application name does not match any application on the node, the query returns null.
Type: | Uri |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ContinuationToken
Specifies the continuation token which can be used to retrieve the next page of query results.
If too many results respect the provided filters, they may not fit into one message. Paging is used to account for this by splitting the collection of returned results into separate pages. The continuation token is used to know where the previous page left off, carrying significance only to the query itself. This value should be generated from running this query, and can be passed into the next query request in order to get subsequent pages. A non-null continuation token value is returned as part of the result only if there is a subsequent page. If this value is provided without the -GetSinglePage option, then the query will return all pages starting from the continuation token value.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-GetSinglePage
Specifies whether the query will return one page of query results with a continuation token value, or all pages combined into one list of results. If this option is selected, then it is the responsibility of the caller of the query to check for subsequent pages.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IncludeHealthState
Specifies whether the query will return the health state of deployed applications.If this parameter is not specified, then the health state returned is "Unknown". When selected, the query goes in parallel to the node and the health system service before the results are merged. As a result, the query is more expensive and may take a longer time.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MaxResults
Specifies the max number of result items that can be returned per page. This defines the upper bound for the number of results returned, not a minimum. For example, if the page fits at most 1000 returned items according to max message size restrictions defined in the configuration, and the MaxResults value is set to 2000, then only 1000 results are returned, even if 2000 result items match the query description.
This value requires selection of the GetSinglePage flag; it will be ignored otherwise.
Type: | Int64 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NodeName
Specifies the name of a Service Fabric node. The cmdlet gets applications deployed on the node that you specify.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TimeoutSec
Specifies the time-out period, in seconds, for the operation.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-UsePaging
Specifies whether the query will be paged. If not selected, then this query will not work when there are too many results to fit onto one page, as defined by the max message size configuration. Selecting this option configures this query to return all results, regardless of the max message size configuration. It does this by getting paged results, and looping through all pages transparently on behalf of the caller.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
System.String
System.Uri
Outputs
System.Object