Skip to content

Commit 598a6fe

Browse files
committed
Initial reference documentation for Microsoft.OpenSSH.SSHD/Windows
1 parent b54ed45 commit 598a6fe

File tree

2 files changed

+247
-0
lines changed

2 files changed

+247
-0
lines changed

docs/reference/resources/Microsoft/OpenSSH/SSHD/Windows/examples/configure-default-shell-powershell.md

Whitespace-only changes.
Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
---
2+
description: Microsoft.OpenSSH.SSHD/Windows resource reference documentation
3+
ms.date: 07/02/2025
4+
ms.topic: reference
5+
title: Microsoft.OpenSSH.SSHD/Windows
6+
---
7+
8+
# Microsoft.OpenSSH.SSHD/Windows
9+
10+
## Synopsis
11+
12+
Manage SSH client and server configuration.
13+
14+
## Metadata
15+
16+
```yaml
17+
Version : 0.1.0
18+
Kind : resource
19+
Tags : [Windows]
20+
Author : Microsoft
21+
```
22+
23+
## Instance definition syntax
24+
25+
```yaml
26+
resources:
27+
- name: <instance name>
28+
type: Microsoft.OpenSSH.SSHD/Windows
29+
properties:
30+
# Required properties
31+
# Instance properties
32+
_exist:
33+
# Add other properties as needed
34+
```
35+
36+
## Description
37+
38+
The `Microsoft.OpenSSH.SSHD/Windows` resource enables you to idempotently manage SSH server
39+
configuration. The resource can:
40+
41+
- Add, update, and remove SSH client and server configuration settings.
42+
43+
> [!NOTE]
44+
> This resource is installed with DSC itself on systems.
45+
>
46+
> You can update this resource by updating DSC. When you update DSC, the updated version of this
47+
> resource is automatically available.
48+
49+
## Requirements
50+
51+
- The resource requires OpenSSH server and client to be installed on the Windows system.
52+
- The resource must run in a process context that has permissions to manage the SSH server
53+
configuration settings.
54+
- The resource must run at least under a Windows Server 2019 or Windows 10 (build 1809)
55+
operating system.
56+
57+
## Capabilities
58+
59+
The resource has the following capabilities:
60+
61+
- `get` - You can use the resource to retrieve the actual state of an instance.
62+
- `set` - You can use the resource to enforce the desired state for an instance.
63+
- `export` - You can use the resource to export the SSHD configuration of existing instances.
64+
65+
This resource uses the synthetic test functionality of DSC to determine whether an instance is in
66+
the desired state. For more information about resource capabilities, see
67+
[DSC resource capabilities][00].
68+
69+
## Examples
70+
71+
<!-- Example definitions would need to be created as separate files -->
72+
73+
1. [Configure default shell PowerShell][03] - Shows how to set the default shell to PowerShell.exe
74+
75+
## Properties
76+
77+
The following list describes the properties for the resource.
78+
79+
- **Required properties:** <a id="required-properties"></a> The following properties are always
80+
required when defining an instance of the resource. An instance that doesn't define each of these
81+
properties is invalid. For more information, see the "Required resource properties" section in
82+
[DSC resource properties][01]
83+
84+
- [shell](#shell) - The path to the default shell for SSH.
85+
86+
- **Key properties:** <a id="key-properties"> The following properties uniquely identify an
87+
instance. If two instances of a resource have the same values for their key properties, the
88+
instances are conflicting. For more information about key properties, see the "Key resource
89+
properties" section in [DSC resource properties][02].
90+
91+
- [shell](#shell) (required) - The path to the default shell for SSH.
92+
93+
- **Instance properties:** <a id="instance-properties"></a> The following properties are optional.
94+
They define the desired state for an instance of the resource.
95+
96+
- [cmd_option](#cmd_option) - Specifies command-line options for the shell.
97+
- [escape_arguments](#escape_arguments) - Specifies whether shell arguments should be escaped.
98+
- [shell_arguments](#shell_arguments) - Specifies the arguments to pass to the shell.
99+
100+
### shell
101+
102+
<details><summary>Expand for <code>shell</code> property metadata</summary>
103+
104+
```yaml
105+
Type : string
106+
IsRequired : true
107+
IsKey : true
108+
IsReadOnly : false
109+
IsWriteOnly : false
110+
```
111+
112+
</details>
113+
114+
Defines the path to the default shell executable to use for SSH sessions.
115+
This property is required and must specify a valid path to an executable on the system.
116+
117+
### cmd_option
118+
119+
<details><summary>Expand for <code>cmd_option</code> property metadata</summary>
120+
121+
```yaml
122+
Type : string
123+
IsRequired : false
124+
IsKey : false
125+
IsReadOnly : false
126+
IsWriteOnly : false
127+
```
128+
129+
</details>
130+
131+
Specifies optional command-line options to pass to the shell when it's launched.
132+
133+
### escape_arguments
134+
135+
<details><summary>Expand for <code>escape_arguments</code> property metadata</summary>
136+
137+
```yaml
138+
Type : boolean
139+
IsRequired : false
140+
IsKey : false
141+
IsReadOnly : false
142+
IsWriteOnly : false
143+
```
144+
145+
</details>
146+
147+
Determines whether shell arguments should be escaped. When set to `true`, the arguments provided
148+
in `shell_arguments` will be properly escaped before being passed to the shell.
149+
150+
### shell_arguments
151+
152+
<details><summary>Expand for <code>shell_arguments</code> property metadata</summary>
153+
154+
```yaml
155+
Type : array
156+
ItemsType : string
157+
ItemsMustBeUnique : false
158+
ItemsMinimumCount : 0
159+
IsRequired : false
160+
IsKey : false
161+
IsReadOnly : false
162+
IsWriteOnly : false
163+
```
164+
165+
</details>
166+
167+
Specifies an array of arguments to pass to the shell when it's launched.
168+
Each element in the array represents a separate argument.
169+
170+
## Instance validating schema
171+
172+
The following snippet contains the JSON Schema that validates an instance of the resource. The
173+
validating schema only includes schema keywords that affect how the instance is validated. All
174+
non validating keywords are omitted.
175+
176+
```json
177+
{
178+
"type": "object",
179+
"required": ["shell"],
180+
"additionalProperties": false,
181+
"properties": {
182+
"shell": {
183+
"type": "string"
184+
},
185+
"cmd_option": {
186+
"type": "string"
187+
},
188+
"escape_arguments": {
189+
"type": "boolean"
190+
},
191+
"shell_arguments": {
192+
"type": "array",
193+
"items": {
194+
"type": "string"
195+
}
196+
}
197+
}
198+
}
199+
```
200+
201+
## Exit codes
202+
203+
The resource returns the following exit codes from operations:
204+
205+
- [0](#exit-code-0) - Success
206+
- [1](#exit-code-1) - Invalid parameter
207+
- [2](#exit-code-2) - Invalid input
208+
- [3](#exit-code-3) - SSH configuration error
209+
- [4](#exit-code-4) - Json serialization failed
210+
211+
### Exit code 0
212+
213+
Indicates the resource operation completed without errors.
214+
215+
### Exit code 1
216+
217+
Indicates the resource operation failed due to an invalid parameter. When the resource returns this
218+
exit code, it also emits an error message with details about the invalid parameter.
219+
220+
### Exit code 2
221+
222+
Indicates the resource operation failed because the input instance was invalid. When the resource
223+
returns this exit code, it also emits one or more error messages with details describing how the
224+
input instance was invalid.
225+
226+
### Exit code 3
227+
228+
Indicates the resource operation failed due to an error in the SSH server configuration. When the
229+
resource returns this exit code, it also emits the error message related to the SSH configuration issue.
230+
231+
### Exit code 4
232+
233+
Indicates the resource operation failed because the result couldn't be serialized to JSON.
234+
235+
## See also
236+
237+
- [Microsoft.DSC/PowerShell resource][03]
238+
- For more information about OpenSSH, see [OpenSSH Documentation][04]
239+
240+
<!-- Link definitions -->
241+
[00]: ../../../../../concepts/resources/capabilities.md
242+
[01]: ../../../../../concepts/resources/properties.md#required-resource-properties
243+
[02]: ../../../../../concepts/resources/properties.md#key-resource-properties
244+
[03]: ../../../DSC/PowerShell/index.md
245+
[04]: /windowsserverdocs/WindowsServerDocs/administration/OpenSSH/openssh-overview
246+
[05]: ./examples/configure-default-shell-powershell.md
247+

0 commit comments

Comments
 (0)