knife-azure 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -201
  3. data/README.md +37 -654
  4. data/lib/azure/resource_management/ARM_deployment_template.rb +87 -50
  5. data/lib/azure/resource_management/ARM_interface.rb +236 -516
  6. data/lib/azure/resource_management/vnet_config.rb +254 -0
  7. data/lib/azure/resource_management/windows_credentials.rb +109 -61
  8. data/lib/azure/service_management/ASM_interface.rb +17 -1
  9. data/lib/azure/service_management/certificate.rb +37 -13
  10. data/lib/azure/service_management/connection.rb +0 -0
  11. data/lib/azure/service_management/deploy.rb +0 -0
  12. data/lib/azure/service_management/disk.rb +0 -0
  13. data/lib/azure/service_management/host.rb +0 -0
  14. data/lib/azure/service_management/image.rb +0 -0
  15. data/lib/azure/service_management/rest.rb +0 -0
  16. data/lib/azure/service_management/role.rb +0 -0
  17. data/lib/azure/service_management/utility.rb +0 -0
  18. data/lib/chef/knife/azure_base.rb +100 -0
  19. data/lib/chef/knife/azure_image_list.rb +0 -0
  20. data/lib/chef/knife/azure_server_create.rb +0 -98
  21. data/lib/chef/knife/azure_server_delete.rb +0 -0
  22. data/lib/chef/knife/azure_server_list.rb +0 -0
  23. data/lib/chef/knife/azure_server_show.rb +0 -0
  24. data/lib/chef/knife/azurerm_base.rb +42 -9
  25. data/lib/chef/knife/azurerm_server_create.rb +31 -24
  26. data/lib/chef/knife/azurerm_server_delete.rb +1 -10
  27. data/lib/chef/knife/azurerm_server_list.rb +5 -1
  28. data/lib/chef/knife/azurerm_server_show.rb +5 -1
  29. data/lib/chef/knife/bootstrap/bootstrap_options.rb +12 -18
  30. data/lib/chef/knife/bootstrap/bootstrapper.rb +34 -15
  31. data/lib/chef/knife/bootstrap/common_bootstrap_options.rb +21 -24
  32. data/lib/chef/knife/bootstrap_azure.rb +58 -0
  33. data/lib/chef/knife/bootstrap_azurerm.rb +40 -50
  34. data/lib/knife-azure/version.rb +1 -1
  35. metadata +27 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7780820cde5aa319045cb5befac28e85a6233112
4
- data.tar.gz: 52a53c5e75597f6147ec4b296a44fa3e3743ca9f
3
+ metadata.gz: c7f62c21c7c40eabb96c27a4b3de2b33a4616457
4
+ data.tar.gz: 25c860f8aa805e2e83909ffeb7d0804e3d6ead15
5
5
  SHA512:
6
- metadata.gz: b8b3d1f5345d5be91208a53fc9f0deb834e5507c3981e3855b328ad72b63b47391c537f1d0d5dcb501a669fe66cead87830b57851e296649e09406c0a580c2a5
7
- data.tar.gz: e85e41b2659b2555dd16792af670ca805926f7a136a04d68b03ce033e09031335997fb611142e5d87dd533ba2adac155fa8bf1498900e9c677829227a68638ef
6
+ metadata.gz: a7ec459dcbf6f9ecf514a9db49a1eb0f9544fffaa48ddcfd9ea38fbe56d564a6b3b3a0baf2403c957978e3866b5ac3237e631ec355082fada69160682a55f710
7
+ data.tar.gz: 7f95bfe8dc727323a8b8b5de4d7e4ce0efa49e75c592539f37709b6fb68247a7b4d39d90bba70f66bcfa29900dba5c867b022aa6b732d8c3da6fcbb4c836327a
data/LICENSE CHANGED
@@ -1,201 +1,201 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md CHANGED
@@ -1,22 +1,20 @@
1
1
  # Knife Azure
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/knife-azure.svg)](https://rubygems.org/gems/knife-azure)
4
- [![Build Status](https://travis-ci.org/chef/knife-azure.svg?branch=master)](https://travis-ci.org/chef/knife-azure)
3
+ [![Gem Version](https://badge.fury.io/rb/knife-azure.svg)](https://rubygems.org/gems/knife-azure) [![Build Status](https://travis-ci.org/chef/knife-azure.svg?branch=master)](https://travis-ci.org/chef/knife-azure)
5
4
 
6
5
  ## Description
7
- A [knife] (http://docs.chef.io/knife.html) plugin to create, delete, and enumerate
8
- [Microsoft Azure] (https://azure.microsoft.com) resources to be managed by Chef.
9
6
 
10
- NOTE: You may also want to consider using the [azure-xplat-cli](https://github.com/Azure/azure-xplat-cli),
11
- this application is written by the Azure team and has many other integrations with
12
- Azure. If click [here](https://github.com/chef-partners/azure-chef-extension/blob/master/examples/azure-xplat-cli-examples.md)
13
- you'll see deeper examples of using the Chef extension and Azure.
7
+ A [knife] (<http://docs.chef.io/knife.html>) plugin to create, delete, and enumerate [Microsoft Azure] (<https://azure.microsoft.com>) resources to be managed by Chef.
8
+
9
+ NOTE: You may also want to consider using the [azure-xplat-cli](https://github.com/Azure/azure-xplat-cli), this application is written by the Azure team and has many other integrations with Azure. If click [here](https://github.com/chef-partners/azure-chef-extension/blob/master/examples/azure-xplat-cli-examples.md) you'll see deeper examples of using the Chef extension and Azure.
14
10
 
15
11
  ## Installation
16
- Be sure you are running the latest version of Chef DK, which can be installed
17
- via:
18
12
 
19
- https://downloads.chef.io/chef-dk/
13
+ Be sure you are running the latest version of Chef DK, which can be installed via:
14
+
15
+ ```
16
+ https://downloads.chef.io/chef-dk/
17
+ ```
20
18
 
21
19
  This plugin is distributed as a Ruby Gem. To install it, run:
22
20
 
@@ -24,14 +22,14 @@ This plugin is distributed as a Ruby Gem. To install it, run:
24
22
  chef gem install knife-azure
25
23
  ```
26
24
 
27
- Depending on your system's configuration, you may need to run this command
28
- with root/administrator privileges.
25
+ Depending on your system's configuration, you may need to run this command with root/administrator privileges.
29
26
 
30
27
  ## Modes
28
+
31
29
  `knife-azure 1.6.0` onwards, we are adding support for Azure Resource Manager. You can easily switch between the
32
30
 
33
- * Service management: commands using the Azure service management API
34
- * Resource manager: commands using the Azure Resource Manager API
31
+ - Service management: commands using the Azure service management API
32
+ - Resource manager: commands using the Azure Resource Manager API
35
33
 
36
34
  They are not designed to work together. Commands starting with `knife azure` use ASM mode, while commands starting with `knife azurerm` use ARM mode.
37
35
 
@@ -39,656 +37,41 @@ PLEASE NOTE that `Azuererm` subcommands are experimental and of alpha quality. N
39
37
 
40
38
  ## Configuration
41
39
 
42
- ### ASM mode
43
- For this plugin to interact with Azure's REST API, you will need to give Knife
44
- information about your Azure account and credentials. The easiest way to do
45
- this is to sign in to the Azure portal and download a publishsettings file
46
- from https://manage.windowsazure.com/publishsettings/index?client=xplat to a
47
- local file system location, and
48
- then refer to the local file via an entry in your knife.rb:
49
-
50
- knife[:azure_publish_settings_file] = "~/myazure.publishsettings"
51
-
52
- Alternatively, all subcommands for this plugin will accept an
53
- --azure-publish-settings-file option to allow you to specify the path to that
54
- file with each command invocation.
55
-
56
- The plug-in also accepts authentication information specified using an
57
- alternative set of options -- see the section on "Alternative Management
58
- Certificate Specification" for details.
59
-
60
- The plug-in can also read Azure account and credentials from the `Azure Profile` if Knife does not have the entry for `publish_settings_file`.
61
- An `Azure Profile` is a `JSON` file with subscription and environment information in it. Its default location is `~/.azure/azureProfile.json`.
62
-
63
- The Azure Profile file can be created and manipulated using the [Azure CLI](http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-command-line-tools/). You can
64
- also refer [Azure Xplat-CLI](https://github.com/Azure/azure-xplat-cli#use-publish-settings-file-management-certificate-authentication).
65
-
66
- If Azure Profile file has entries for multiple subscriptions then you can choose the default using `azure account set <subscription_name>`. The same default subscription will
67
- be picked up that you have configured.
68
-
69
- ### ARM mode
70
- ARM mode requires setting up service principal for authentication and permissioning. For setting up a service principal from the command line please refer
71
- [Authenticating a service principal with Azure Resource Manager](http://aka.ms/cli-service-principal) or
72
- [Unattended Authentication](http://aka.ms/auth-unattended). For detailed explanation of authentication in Azure,
73
- see [Developer’s guide to auth with Azure Resource Manager API](http://aka.ms/arm-auth-dev-guide).
74
-
75
- After creating the service principal, you should have these 3 values, a client id (GUID), client secret(string) and tenant id (GUID).
76
-
77
- Be sure when you are creating the above user you change the example from `-o Reader` to `-o Contributor` otherwise you will not be able
78
- to spin up or delete machines.
79
-
80
- Put the following in your `knife.rb`
81
-
82
- ```ruby
83
- knife[:azure_tenant_id] # found via: tenantId=$(azure account show -s <subscriptionId> --json | jq -r '.[0].tenantId')
84
- knife[:azure_subscription_id] # found via: <subscriptionId>
85
- knife[:azure_client_id] # appId=$(azure ad app show --search <principleappcreated> --json | jq -r '.[0].appId')
86
- knife[:azure_client_secret] # password you set at initally
87
- ```
88
-
89
- ## Basic Examples for ASM
90
- The following examples assume that you've configured the publishsettings file
91
- location in your knife.rb:
92
-
93
- # List images for use in creating new VM's:
94
- $ knife azure image list
95
-
96
- # List all VM's (including those not be managed by Chef)
97
- $ knife azure server list
98
-
99
- # Create and bootstrap a Windows VM over winrm (winrm is the default for Windows)
100
- $ knife azure server create --azure-dns-name MyNewServerName --azure-vm-size Medium -I a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20150825-en.us-127GB.vhd --azure-service-location 'West US' --winrm-user myuser --winrm-password 'mypassword'
101
-
102
- # Create and bootstrap a Windows VM over winrm using SSL (winrm is the default for Windows)
103
- $ knife azure server create --azure-dns-name MyNewServerName --azure-vm-size Medium -I a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20150825-en.us-127GB.vhd --azure-service-location 'West US' --winrm-user myuser --winrm-password 'mypassword' --winrm-transport ssl --winrm-ssl-verify-mode verify_none
104
-
105
- # Create and bootstrap an Ubuntu VM over ssh
106
- $ knife azure server create -N MyNewNode --azure-vm-size Medium -I b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20140927-en-us-30GB -m 'West US' --ssh-user myuser --identity-file ~/.ssh/myprivatekey_rsa
107
-
108
- # Create and bootstrap an Windows VM through the Azure API --
109
- # No winrm or ssh transport or Internet access required
110
- $ knife azure server create --azure-dns-name MyNewServerName --azure-vm-size Medium -I a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20150825-en.us-127GB.vhd --azure-service-location 'West US' --winrm-user myuser --winrm-password 'mypassword' --bootstrap-protocol cloud-api
111
-
112
- # Delete a server and purge it from the Chef server
113
- $ knife azure server delete MyNewNode --purge -y
114
-
115
- Use the --help option to read more about each subcommand. Eg:
116
-
117
- knife azure server create --help
118
-
119
- ## Detailed Usage for ASM mode
120
-
121
- ### Common Configuration
122
- Most configuration options can be specified either in your knife.rb file or as command line parameters. The CLI parameters override the knife.rb parameters.
123
-
124
- The following options are required for all subcommands:
125
-
126
- option :azure_publish_settings_file Path to your .publishsettings file
127
-
128
- OR
129
-
130
- option :azure_subscription_id Your Azure subscription ID
131
- option :azure_mgmt_cert Management certificate in PEM format
132
- option :azure_api_host_name Your Azure API host name
133
-
134
- ### Azure Image List Subcommand
135
- Outputs a list of all linux images that are available to use for provisioning. You should choose one of these to use for the :azure_source_image parameter to the server create command. You can use the filter option to see a detailed image list.
136
-
137
- knife azure image list
138
-
139
- ### Azure Server Create Subcommand
140
- This subcommand provisions a new server in Azure and then performs a Chef bootstrap. The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server.
141
-
142
- #### Windows Bootstrapping Requirements
143
- knife-azure depends on knife-windows: https://github.com/chef/knife-windows
144
- to bootstrap Windows machines via WinRM (Basic, NTLM and Kerberos authentication) or ssh.
145
-
146
- The distro/template to be used for bootstrapping is: https://github.com/chef/knife-windows/blob/master/lib/chef/knife/bootstrap/windows-chef-client-msi.erb
147
-
148
- Windows source images should have the WinRM service enabled and the
149
- authentication should be set accordingly (Basic, NTLM and Kerberos). Firewall rules should be added accordingly to the source images. Refer to the link to configure this:
150
- https://github.com/chef/knife-windows#nodes
151
-
152
- #### Azure-specific Options
153
- :azure_dns_name Required. The DNS prefix name that can be used to access the cloud
154
- service which is unique within Microsoft Azure. If you want to add
155
- new VM to an existing service/deployment, specify an exiting
156
- dns-name, along with --azure-connect-to-existing-dns option. Otherwise
157
- a new deployment is created.
158
- :azure_service_location Required. Specifies the geographic location of the resource as the
159
- name of a datacenter location that is valid for your subscription. Eg:
160
- West US, East US, East Asia, Southeast Asia, North Europe, West Europe.
161
- :azure_source_image Required. Specifies the name of the disk image to use to create
162
- the virtual machine. Do a "knife azure image list" to see a
163
- list of available images.
164
- :azure_storage_account A name for the storage account that is unique within Microsoft Azure.
165
- Storage account names must be between 3 and 24 characters in
166
- length and use numbers and lower-case letters only. This name is
167
- the DNS prefix name and can be used to access blobs, queues, and
168
- tables in the storage account.
169
- :azure_vm_name Specifies the name for the virtual machine. The name must
170
- be unique within the deployment.
171
- :azure_os_disk_name Optional. Specifies the friendly name of the disk containing
172
- the guest OS image in the image repository.
173
- :azure_vm_size Size of virtual machine. Default is Small.
174
- (ExtraSmall, Small, Medium, Large, ExtraLarge)
175
- :azure_connect_to_existing_dns Set this flag to add the new VM to an existing
176
- deployment/service. Must give the name of the existing
177
- DNS correctly in the --azure-dns-name option
178
- :azure_availability_set Optional. Name of availability set to add virtual machine into.
179
-
180
- #### Azure VM Quick Create
181
- You can create a server with minimal configuration. On the Azure Management Portal, this corresponds to a "Quick Create - VM". Sample command for quick create (for an Ubuntu instance):
182
-
183
- knife azure server create
184
- --azure-publish-settings-file '/path/to/your/cert.publishsettingsfile'
185
- --azure-dns-name 'myservice'
186
- --azure-service-location 'West US'
187
- --azure-source-image 'source-image-name'
188
- --ssh-user 'jetstream'
189
- --identity-file '~/.ssh/myazure_rsa'
190
-
191
- Note that the --identity-file option, which enables specification of a private
192
- key authorized to communicate securely with the created server during the
193
- bootstrap process, will also configure the user specified by --ssh-user with
194
- the public key that corresponds to the private key specified by
195
- --identity-file. This configuration persists even after the create subcommand
196
- has completed successfully, so that the key specified with --identity-file can
197
- be used with ssh clients for subsequent access to the server as the user
198
- specified by --ssh-user.
199
-
200
- You can set these options from knife.rb. A typical knife.rb is
201
- shown below:
202
-
203
- knife[:azure_publish_settings_file] = '/path/to/your/cert.publishsettingsfile'
204
- knife[:azure_dns_name] = 'myservice'
205
- knife[:azure_service_location] = 'West US'
206
- knife[:azure_source_image] = 'source-image-name'
207
- knife[:ssh_user] = 'jetstream'
208
- knife[:identity_file] = '~/.ssh/myazure_rsa'
209
-
210
- #### Azure VM Advanced Create
211
- You can set various other options in the advanced create.
212
- Eg: If you want to set the Azure VM Name different from that of the Azure DNS Name, set the option :azure_vm_name.
213
- Eg: If you want to specify a Storage Account Name, set the option :azure_storage_account
214
-
215
- To connect to an existing DNS/service, you can use a command as below:
216
-
217
- knife azure server create
218
- --azure-subscription-id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
219
- --azure-mgmt-cert '/path/to/your/mgmtCert.pem'
220
- --azure-api-host-name 'management.core.windows.net'
221
- --azure-connect-to-existing-dns
222
- --azure-dns-name 'myservice'
223
- --azure-vm-name 'myvm02'
224
- --azure-service-location 'West US'
225
- --azure-source-image 'source-image-name'
226
- --ssh-user 'jetstream'
227
- --ssh-password 'jetstream@123'
228
-
229
- These options may also be configured from knife.rb, as in this example:
230
-
231
- knife[:azure_subscription_id] = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
232
- knife[:azure_mgmt_cert] = '/path/to/your/mgmtCert.pem'
233
- knife[:azure_api_host_name] = 'management.core.windows.net'
234
- knife[:azure_service_location] = 'West US'
235
- knife[:azure_dns_name]='myservice'
236
- knife[:azure_vm_name]='myvm02'
237
- knife[:ssh_user]='jetstream'
238
- knife[:identity_file]='/path/to/RSA/private/key'
239
- knife[:azure_storage_account]='auxpreview104'
240
- knife[:azure_os_disk_name]='disk107'
241
- knife[:tcp-endpoints]='80:80,3389:5678'
242
- knife[:udp-endpoints]='123:123'
243
-
244
- #### Endpoint configuration
245
-
246
- Endpoints are configured using tcp-endpoints and udp-endpoints. This is a string in the form:
247
- {localPort}:{publicPort}:{load_balancer_set_name}:{load_balancer_probe_path}
248
-
249
- Examples:
250
-
251
- knife[:tcp-endpoints]='80' # Allow Port 80 inbound
252
- knife[:tcp-endpoints]='80:8080' # Allow Port 80 inbound and map it to local port 8080
253
- knife[:tcp-endpoints]='80:8080:web-set' # Allow Port 80 and add it to the load balancing set called 'web-set'
254
- knife[:tcp-endpoints]='80:8080:web-set:/healthcheck' # Allow Port 80, add it to the load balancing set, and use an HTTP probe at path "/healthcheck"
255
-
256
- Note that the load balancing set will be created if it does not exist. If it exists within another VM in the cloud service, it will re-use those values for the probe.
257
-
258
- #### Options for Bootstrapping a Windows Node in Azure
259
-
260
- :bootstrap_protocol Default is winrm for a windows image
261
- :winrm_password The WinRM password
262
- :winrm_authentication_protocol Defaults to negotiate, supports kerberos, can be set to basic for debugging
263
- :winrm_transport Defaults to plaintext, use ssl for improved privacy
264
- :winrm_port Defaults to 5985 plaintext transport, or 5986 for SSL
265
- :ca_trust_file The CA certificate file to use to verify the server when using SSL
266
- :winrm_ssl_verify_mode Defaults to verify_peer, use verify_none to skip validation of the server certificate during testing
267
- :kerberos_keytab_file The Kerberos keytab file used for authentication
268
- :kerberos_realm The Kerberos realm used for authentication
269
- :kerberos_service The Kerberos service used for authentication
270
-
271
-
272
- #### Options to configure WinRM for Bootstrapping a Windows Node
273
- Theses options are useful if you have long-running run-lists and if the chef run might use a lot of memory. In most cases people don't need to set these, but if they see certain timeout or memory related errors during bootstrap, particularly on Win2k8r2, it may make sense to move these beyond the default.
274
-
275
- :winrm_max_timeout Set winrm max timeout in minutes
276
- :winrm_max_memoryPerShell Set winrm max memory per shell in MB
277
-
278
- Command:
279
- knife azure server create
280
- --azure-dns-name 'myserver'
281
- --azure-source-image 'windows-2012-image-id'
282
- --azure-service-location 'West US'
283
- --winrm-user azure
284
- --winrm-password 'azure@123'
285
- --winrm-max-timeout 30
286
- --winrm-max-memoryPerShell 400
287
-
288
- #### Azure Windows Node Create
289
- The quick create option requires the following options for a windows instance:
290
-
291
- knife azure server create
292
- --azure-publish-settings-file '/path/to/your/cert.publishsettingsfile'
293
- --azure-dns-name 'myserverdnsname'
294
- --azure-service-location 'West US'
295
- --azure-source-image 'windows-2012-image-id'
296
- --winrm-user 'jetstream'
297
- --winrm-password 'jetstream@123'
298
- --distro 'windows-chef-client-msi'
299
-
300
- Sample knife.rb for bootstrapping Windows Node with basic authentication
301
-
302
- knife[:bootstrap_protocol] = 'winrm'
303
- knife[:winrm_password] = 'mgcvTuvV2Rh'
304
- knife[:winrm_user] = 'myuser'
305
- knife[:winrm_port] = '5985'
306
- knife[:distro] = 'windows-chef-client-msi'
307
- knife[:azure_source_image]='windows-2012-image-id'
308
-
309
- #### `cloud-api` bootstrap feature
310
- By specifying the value `cloud-api` for the `bootstrap_protocol` option of `knife azure server create` instead of `winrm` or `ssh`, Microsoft Azure will install Chef Client using its own internal mirror of Chef Client (it does not download it from Chef's Internet facing URL's as in the conventional winrm / ssh bootstrap). The process as a whole is asynchronous, so once the `knife azure server create` command has create the VM, full provisioning and Chef bootstrap will continue to occur even if the `knife` command is terminated before it completes.
311
-
312
- In general, systems bootstrapped via `cloud-api` do not require incoming or outgoing Internet access.
313
-
314
- knife azure server create
315
- --azure-publish-settings-file '/path/to/your/cert.publishsettingsfile'
316
- --azure-dns-name 'myserverdnsname'
317
- --azure-service-location 'West US'
318
- --azure-source-image 'windows-2012-image-id'
319
- --winrm-user 'jetstream'
320
- --winrm-password 'jetstream@123'
321
- --bootstrap-protocol 'cloud-api'
322
- --delete-chef-extension-config
323
-
324
- We have also added cloud-api support for Centos now, for this you just need to select centos image in above example.
325
-
326
- `--delete-chef-extension-config` determines if Chef configuration files should be removed when Azure removes the Chef resource extension from the VM or not. This option is only valid for the 'cloud-api' bootstrap protocol. The default value is false. This is useful when `update` and `uninstall` commands are run for the extension on the VM created.
327
-
328
- It's possible to pass bootstrap options to the extension which get specified in `client.rb` file on the VM. Following options can be passed:
329
-
330
- --environment
331
- --node-name
332
- --secret-file
333
- --server
334
- --validation-client-name
335
- --[no-]node-verify-api-cert
336
- --bootstrap-version
337
- --node-ssl-verify-mode
338
- --bootstrap-proxy
339
-
340
-
341
- #### Azure Server Create with Domain Join
342
- Following options are used for creating server with domain join
343
-
344
- :azure_domain_name Specifies the domain name to join. If the domains name is not specified, --azure-domain-user must specify the user principal name (UPN) format (user@fully-qualified-DNS-domain) or the fully-qualified-DNS-domain\\username format
345
- :azure_domain_user Specifies the username who has access to join the domain.Supported format: username(if domain is already specified in --azure-domain-name option),fully-qualified-DNS-domain\username, user@fully-qualified-DNS-domain
346
- :azure_domain_passwd Specifies the password for domain user who has access to join the domain
347
-
348
- Command:
349
- knife azure server create -I a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-Datacenter-20151022-en.us-127GB.vhd --azure-vm-size Medium -x 'azure' -P 'admin@123' --azure-domain-passwd 'admin@123' --azure-domain-user 'some.domain.com\user' --azure-domain-name 'some.domain.com' -c '~\chef-repo\.chef\knife.rb' --azure-network-name 'mynetwork' --azure-subnet-name 'subnet1' --azure-service-location 'West US'
350
-
351
-
352
- ### Azure Server Delete Subcommand
353
- Deletes an existing server in the currently configured Azure account. By
354
- default, this does not delete the associated node and client objects from the
355
- Chef server. To do so, add the --purge flag. Also by default, the DNS name, also called "cloud service", is deleted if you are deleting the last VM from that service. By default, the OS disk is also deleted. The underlying VHD blob is also deleted by default. If you want to retain them add the --preserve flag as shown below. To delete the storage account, add the --delete-azure-storage-account flag since by default the storage account is not deleted.
356
-
357
- knife azure server delete "myvm01"
358
- knife azure server delete "myvm01" --purge #purge chef node
359
- knife azure server delete "myvm01" --preserve-azure-os-disk
360
- knife azure server delete "myvm01" --preserve-azure-vhd
361
- knife azure server delete "myvm01" --preserve-azure-dns-name
362
- knife azure server delete "myvm01" --delete-azure-storage-account
363
-
364
- Since the VM name can be the same across DNS name, you must specify the DNS
365
- name also to delete the VM. Sample command to delete a VM for a given DNS name:
366
-
367
- knife azure server delete "myvm01" --azure-dns-name "mydnsname"
368
- knife azure server delete "myvm01" "myvm02" --azure-dns-name "mydnsname"
369
-
370
- ### Azure Server List Subcommand
371
- Outputs a list of all servers in the currently configured Azure account. PLEASE NOTE - this shows all instances associated with the account, some of which may not be currently managed by the Chef server.
372
-
373
- knife azure server list
40
+ 1. [ASM Configuration] (docs/configuration.md#asm-mode)
41
+ 2. [ARM Configuration] (docs/configuration.md#arm-mode)
374
42
 
375
- ### Azure AG List Subcommand
376
- Outputs a list of defined affinity groups in the azure subscription.
43
+ ## Detailed Usage
377
44
 
378
- knife azure ag list
45
+ 1. [ASM Mode] (docs/ASM.md)
46
+ 2. [ARM Mode] (docs/ARM.md)
379
47
 
380
- ### Azure AG Create Subcommand
381
- Creates a new affinity group in the specified service location.
48
+ ## Bootstrap existing VM to install the chef-client using chef-extension :
382
49
 
383
- knife azure ag create -a 'mynewag' -m 'West US' --azure-ag-desc 'Optional Description'
50
+ We have added a utility in ASM and ARM to bootstrap existing VM. This will install the chef-client using chef extension on your VM.
384
51
 
385
- Knife options:
52
+ 1. [Bootstrap Doc for ASM Mode] (docs/bootstrap.md#asm-mode)
53
+ 2. [Bootstrap Doc for ARM Mode] (docs/bootstrap.md#arm-mode)
386
54
 
387
- :azure_affinity_group Specifies new affinity group name.
388
- :azure_service_location Specifies the geographic location.
389
- :azure_ag_desc Optional. Description for new affinity group.
55
+ ## Contributing
390
56
 
391
- ### Azure Internal LB List Subcommand
392
- Outputs a lit of defined load balancers for all cloud services. Public facing load balancers are not shown here.
57
+ For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
393
58
 
394
- ### Azure Internal LB Create Subcommand
395
- Creates a new Internal Load Balancer within a cloud service.
59
+ ## License
396
60
 
397
- knife azure internal lb create -n 'my_lb' --azure-lb-static-vip '10.0.0.123' --azure-subnet_name 'Subnet_1' --azure-dns-name 'service_name'
61
+ Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
398
62
 
399
- Knife options:
400
- :azure_load_balancer Required. Specifies the name of the Load Balancer.
401
- :azure_lb_static_vip Optional. Allows you to set a static IP for the VIP.
402
- :azure_subnet_name Required ONLY IF azure_lb_static_ip is set. Specifies the subnet that the static IP resides in.
403
- :azure_dns_name Required. The cloud service that this internal Load Balancer will be added to.
63
+ License:: Apache License, Version 2.0
404
64
 
405
- ### Azure Vnet List Subcommand
406
- Outputs a list of defined virtual networks in the azure subscription.
65
+ ```text
66
+ Licensed under the Apache License, Version 2.0 (the "License");
67
+ you may not use this file except in compliance with the License.
68
+ You may obtain a copy of the License at
407
69
 
408
- knife azure vnet list
70
+ http://www.apache.org/licenses/LICENSE-2.0
409
71
 
410
- ### Azure Vnet Create Subcommand
411
- Creates a new or modifies an existing virtual network. If an existing virtual network is named, the
412
- affinity group and address space are replaced with the new values.
413
-
414
- knife azure vnet create -n 'mynewvn' -a 'existingag' --azure_address_space '10.0.0.0/24'
415
-
416
- Knife options:
417
-
418
- :azure_network_name Specifies the name of the virtual network to create.
419
- :azure_affinity_group Specifies the affinity group to associate with the vnet.
420
- :azure_address_space Specifies the address space of the vnet using CIDR notation.
421
-
422
- For CIDR notation, see here: http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
423
- Address available are defined in RFC 1918: http://en.wikipedia.org/wiki/Private_network
424
-
425
- ## Detailed Usage for ARM mode
426
-
427
- ### Common Configuration
428
-
429
- ARM configuration options can be specified in your knife.rb file only.
430
-
431
- The following options are required for all azurerm subcommands:
432
-
433
- option :azure_subscription_id Your Azure subscription ID
434
- option :azure_tenant_id Your subscription's tenant id
435
- option :azure_client_id Your Active Directory Application id
436
- option :azure_client_secret Your Active Directory Application's password
437
-
438
- Note: The options mentioned above can be obtained from this [step](https://github.com/chef/knife-azure#arm-mode)
439
-
440
- ### Azure Server Create Subcommand
441
- This subcommand provisions a new server in Azure and then performs a Chef bootstrap.
442
-
443
- User can either provide just `--azure-image-os-type` or other image reference parameters i.e. `--azure-image-reference-publisher`, `--azure-image-reference-offer`, `--azure-image-reference-sku` and `--azure-image-reference-version` to specify the image.
444
-
445
- Accepted values for `--azure-image-os-type` are `ubuntu`, `centos`, `rhel`, `debian ` and `windows`. It creates the server using standard image parameters for respective OS. However, they can be overridden using `--azure-image-reference-publisher`, `--azure-image-reference-offer`, `--azure-image-reference-sku` and `--azure-image-reference-version` options.
446
- `--azure-image-os-type` option should not be used with other image reference parameters.
447
-
448
- To see a list of commonly used image parameters, please refer https://azure.microsoft.com/en-in/documentation/articles/resource-groups-vm-searching/#table-of-commonly-used-images
449
-
450
- For Windows:
451
-
452
- ```
453
- knife azurerm server create
454
- --azure-resource-group-name MyResourceGrpName
455
- --azure-vm-name MyNewVMName
456
- --azure-service-location 'WEST US'
457
- --azure-image-os-type windows
458
- -x myuser -P mypassword
459
- -r "recipe[cbk1::rec2]"
460
- -c ~/.chef/knife.rb
461
- ```
462
- OR
463
- ```
464
- knife azurerm server create
465
- --azure-resource-group-name MyResourceGrpName
466
- --azure-vm-name MyNewVMName
467
- --azure-service-location 'WEST US'
468
- --azure-image-reference-publisher 'MicrosoftWindowsServer'
469
- --azure-image-reference-offer 'WindowsServer'
470
- --azure-image-reference-sku '2012-R2-Datacenter'
471
- --azure-image-reference-version 'latest'
472
- -x myuser -P mypassword
473
- -r "recipe[cbk1::rec2]"
474
- -c ~/.chef/knife.rb
475
- ```
476
-
477
- For Centos:
478
-
479
- ```
480
- knife azurerm server create
481
- --azure-resource-group-name MyResourceGrpName
482
- --azure-vm-name MyNewVMName
483
- --azure-service-location 'WEST US'
484
- --azure-image-os-type centos
485
- --azure-vm-size Small
486
- -r "recipe[cbk1::rec1]"
487
- -c ~/.chef/knife.rb
488
- ```
489
- OR
490
- ```
491
- knife azurerm server create
492
- --azure-resource-group-name MyResourceGrpName
493
- --azure-vm-name MyNewVMName
494
- --azure-service-location 'WEST US'
495
- --azure-image-reference-publisher 'OpenLogic'
496
- --azure-image-reference-offer 'CentOS'
497
- --azure-image-reference-sku '6.5'
498
- --azure-image-reference-version 'latest'
499
- --ssh-user myuser --ssh-password mypassword
500
- --azure-vm-size Small
501
- -r "recipe[cbk1::rec1]"
502
- -c ~/.chef/knife.rb
503
- ```
504
-
505
- For Ubuntu:
506
-
507
- ```
508
- knife azurerm server create
509
- --azure-resource-group-name MyResourceGrpName
510
- --azure-vm-name MyNewVMName
511
- --azure-service-location 'WEST US'
512
- --azure-image-os-type ubuntu
513
- --ssh-user myuser --ssh-password mypassword
514
- --azure-vm-size Small
515
- -r "recipe[cbk1::rec1]"
516
- -c ~/.chef/knife.rb
517
- ```
518
- OR
519
- ```
520
- knife azurerm server create
521
- --azure-resource-group-name MyResourceGrpName
522
- --azure-vm-name MyNewVMName
523
- --azure-service-location 'WEST US'
524
- --azure-image-reference-publisher 'Canonical'
525
- --azure-image-reference-offer 'UbuntuServer'
526
- --azure-image-reference-sku '14.04.2-LTS'
527
- --azure-image-reference-version 'latest'
528
- --ssh-user myuser --ssh-password mypassword
529
- --azure-vm-size Small
530
- -r "recipe[cbk1::rec1]"
531
- -c ~/.chef/knife.rb
532
- ```
533
-
534
- For Rhel:
535
-
536
- ```
537
- knife azurerm server create
538
- --azure-resource-group-name MyResourceGrpName
539
- --azure-vm-name MyNewVMName
540
- --azure-service-location 'WEST US'
541
- --azure-image-os-type rhel
542
- --ssh-user myuser --ssh-password mypassword
543
- --azure-vm-size Small
544
- -r "recipe[cbk1::rec1]"
545
- -c ~/.chef/knife.rb
546
- ```
547
- OR
548
- ```
549
- knife azurerm server create
550
- --azure-resource-group-name MyResourceGrpName
551
- --azure-vm-name MyNewVMName
552
- --azure-service-location 'WEST US'
553
- --azure-image-reference-publisher 'RedHat'
554
- --azure-image-reference-offer 'RHEL'
555
- --azure-image-reference-sku '7.2'
556
- --azure-image-reference-version 'latest'
557
- --ssh-user myuser --ssh-password mypassword
558
- --azure-vm-size Small
559
- -r "recipe[cbk1::rec1]"
560
- -c ~/.chef/knife.rb
561
- ```
562
-
563
- For Debian:
564
-
565
- ```
566
- knife azurerm server create
567
- --azure-resource-group-name MyResourceGrpName
568
- --azure-vm-name MyNewVMName
569
- --azure-service-location 'WEST US'
570
- --azure-image-os-type debian
571
- --ssh-user myuser --ssh-password mypassword
572
- --azure-vm-size Small
573
- -r "recipe[cbk1::rec1]"
574
- -c ~/.chef/knife.rb
575
- ```
576
- OR
72
+ Unless required by applicable law or agreed to in writing, software
73
+ distributed under the License is distributed on an "AS IS" BASIS,
74
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
75
+ See the License for the specific language governing permissions and
76
+ limitations under the License.
577
77
  ```
578
- knife azurerm server create
579
- --azure-resource-group-name MyResourceGrpName
580
- --azure-vm-name MyNewVMName
581
- --azure-service-location 'WEST US'
582
- --azure-image-reference-publisher 'credativ'
583
- --azure-image-reference-offer 'Debian'
584
- --azure-image-reference-sku '7'
585
- --azure-image-reference-version 'latest'
586
- --ssh-user myuser --ssh-password mypassword
587
- --azure-vm-size Small
588
- -r "recipe[cbk1::rec1]"
589
- -c ~/.chef/knife.rb
590
- ```
591
-
592
- User can use existing virtual network and subnet while server create by providing `--azure-vnet-name` and `--azure-vnet-subnet-name` options.
593
-
594
- Note:
595
-
596
- 1. If these options are not given, default vnet and subnet with the VM name will be created.
597
- 2. User needs to provide valid existing vnet name and subnet name otherwise it will raise vnet or subnet not found error.
598
- 3. Vnet should belong to the same resource group that is provided in the command.
599
- 4. Subnet should belong to the same vnet that is provided in the command.
600
-
601
- ```
602
- knife azurerm server create
603
- --azure-resource-group-name MyResourceGrpName
604
- --azure-vm-name MyNewVMName
605
- --azure-service-location 'WEST US'
606
- --azure-image-os-type ubuntu
607
- --ssh-user myuser --ssh-password mypassword
608
- --azure-vm-size Small
609
- --azure-vnet-name 'VnetName'
610
- --azure-vnet-subnet-name 'VnetSubnetName'
611
- -r "recipe[cbk1::rec1]"
612
- -c ~/.chef/knife.rb
613
- ```
614
-
615
- #### --server-count option
616
- User can pass `--server-count` option to specify the number of servers to be created with same configuration.
617
- ```
618
- --server-count COUNT Number of servers to create with same configuration. Maximum count is 5. Default value is 1.
619
-
620
- Command:
621
- knife azurerm server create
622
- --azure-resource-group-name MyResourceGrpName
623
- --azure-vm-name MyNewVMName
624
- --azure-service-location 'WEST US'
625
- --azure-image-os-type centos
626
- --azure-vm-size Small
627
- --server-count 3
628
- -x myuser -P mypassword
629
- ```
630
- This will create 3 VMs with names: `MyNewVMName0`, `MyNewVMName1` and `MyNewVMName2`
631
-
632
-
633
- ### Azure Server Delete Subcommand
634
- Deletes an existing ARM server in the currently configured Azure account. By default, this does not delete the associated resource-group, associated node and client objects from the Chef server.
635
- For deleting associated resource-group along with server use --delete-resource-group flag.
636
- For deleting associated node and client objects from the Chef server, add the --purge flag.
637
-
638
- ```
639
- knife azurerm server delete MyVMName --azure-resource-group-name MyResourceGrpName -c ~/.chef/knife.rb
640
-
641
- knife azurerm server delete MyVMName --azure-resource-group-name MyResourceGrpName -c ~/.chef/knife.rb --purge #purge chef node
642
-
643
- knife azurerm server delete MyVMName --azure-resource-group-name MyResourceGrpName -c ~/.chef/knife.rb --delete-resource-group #deletes resource group
644
- ```
645
-
646
- ### Azure Server List Subcommand
647
- Outputs a list of all ARM servers in the currently configured Azure account. PLEASE NOTE - this shows all instances associated with the account, some of which may not be currently managed by the Chef server.
648
-
649
- ```
650
- knife azurerm server list
651
- ```
652
-
653
- ### Azure Server Show Subcommand
654
- Outputs the details of an ARM server.
655
-
656
- ```
657
- knife azurerm server show MyVMName --azure-resource-group-name MyResourceGrpName -c ~/.chef/knife.rb
658
- ```
659
-
660
-
661
- ## Alternative Management Certificate Specification
662
- In addition to specifying the management certificate using the publishsettings
663
- file, you can also specify it in PEM format. Follow these steps to generate the certificate in the PEM format:
664
-
665
- 1. Download the settings file from https://manage.windowsazure.com/publishsettings/index?client=xplat
666
- 2. Extract the data from the ManagementCertificate field into a separate file named - cert.pfx
667
- 3. Decode the certificate file:
668
-
669
- #### On Linux/Mac(Homebrew)
670
-
671
- base64 -d cert.pfx > cert_decoded.pfx
672
-
673
- #### On Windows
674
- You can decode and extract the PFX file using powershell or a free windows base 64 decoder such as http://www.fourmilab.ch/webtools/base64/base64.zip,
675
-
676
- base64.exe -d cert.pfx -> cert_decoded.pfx
677
-
678
- 4. Convert the decoded PFX file to a PEM file
679
-
680
- #### On Linux/Mac(Homebrew)
681
-
682
- openssl pkcs12 -in cert_decoded.pfx -out managementCertificate.pem -nodes
683
-
684
- #### On Windows
685
- Use powershell & run following command. If openssl.exe is not already installed it can be downloaded from http://www.openssl.org/related/binaries.html (Note: openssl depends on Microsoft Visual C++ Redistributable package (x86) which must be installed for openssl to function properly).
686
-
687
- openssl base64 -d -A -in cert_decoded.pfx -out cert_decode.der
688
-
689
- openssl pkcs12 -in cert_decoded.der -out managementCertificate.pem -nodes
690
-
691
- You might be asked to enter a password which is usually blank.
692
- You might be also asked to enter a passphrase. Please enter the phrase of your choice.
693
-
694
- It is possible to generate your own certificates and upload them. More Detailed Documentation about the Management Certificates is available : https://www.windowsazure.com/en-us/manage/linux/common-tasks/manage-certificates/