kitchen-azurerm 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bddd20bd82c0fb19e06a74cd69a93e1ee640eb07f791253fe9a15851f1b6130
4
- data.tar.gz: ed27bd9192b4ec9ebc0b4e57f1ec0dbe4bf846b0d92364e0b61ec4e74f2e1331
3
+ metadata.gz: c53c5b50e83af16c56722ecbc2baa30b5a28621cc17f4edde82a59b22420812f
4
+ data.tar.gz: cd39338fdf0d29d39780e93b6a9fc8c27cd955daf59b6fc79f3be56801c7d891
5
5
  SHA512:
6
- metadata.gz: 69f357bfd30b8c5b53cde84ce691f2193a2d00fb0baa133d6150d85b6d4f0ee40525bdac780cac9cb66a241ce2be59ad3e73aec78c01b451da3a80cd0d50e13e
7
- data.tar.gz: aa96b2f9d5a80515971e46999614224a2b674be6789255eb59b10980636a8f17c8535fab61dd738e13571224a21fe3847dd08313c23a058a09ac853473824257
6
+ metadata.gz: d62cae11a2fa2a679657fc9c81e6b03547802cd7773f6b801b644388beb09b6fe44de2f0d5f2e9a1601cf3eee92b7a2d86e1f29e7dd86b09e3e6445fdceaebd5
7
+ data.tar.gz: 8bbccc8d27fef365420257f9a11d89cd8b326cf6e60c97e737c1fe304b14f28ee543793c314e9e638096b606c6ccc64986e7d4db94345d53463981b84eadc931
data/README.md CHANGED
@@ -10,15 +10,34 @@ This version has been tested on Windows, macOS, and Ubuntu. If you encounter a p
10
10
 
11
11
  ### Installation
12
12
 
13
- This plugin is distributed as a [Ruby Gem](https://rubygems.org/gems/kitchen-azurerm). To install it, run:
13
+ This plugin ships in Chef Workstation out of the box so there is no need to install it when using Chef Workstation[https://downloads.chef.io/products/workstation].
14
14
 
15
- ```$ gem install kitchen-azurerm```
15
+ If you're not using Chef Workstation and need to install the plugin as a gem run:
16
16
 
17
- Note if you are running the ChefDK you may need to prefix the command with chef, i.e. ```$ chef gem install kitchen-azurerm```
17
+ ```$ gem install kitchen-azurerm```
18
18
 
19
19
  ### Configuration
20
20
 
21
- For the driver to interact with the Microsoft Azure Resource management REST API, a Service Principal needs to be configured with Contributor rights against the specific subscription being targeted. Using an Organizational (AAD) account and related password is no longer supported. To create a Service Principal and apply the correct permissions, you will need to [create and authenticate a service principal](https://azure.microsoft.com/en-us/documentation/articles/resource-group-authenticate-service-principal/#authenticate-service-principal-with-password---azure-cli) using the [Azure CLI](https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/). Make sure you stay within the section titled 'Authenticate service principal with password - Azure CLI'.
21
+ For the driver to interact with the Microsoft Azure Resource management REST API, a Service Principal needs to be configured with Contributor rights against the specific subscription being targeted. Using an Organizational (AAD) account and related password is no longer supported. To create a Service Principal and apply the correct permissions, you will need to [create an Azure service principal with the Azure CLI](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest#create-a-service-principal) using the [Azure CLI](https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/). Make sure you stay within the section titled 'Authenticate service principal with password - Azure CLI'.
22
+
23
+ If the above is TLDR then try this after `az login` using your target subscription ID and the desired SP name:
24
+
25
+ ```bash
26
+ # Create a Service Principal using the desired subscription id from the command above
27
+ az ad sp create-for-rbac --name="kitchen-azurerm" --role="Contributor" --scopes="/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
28
+
29
+ #Output
30
+ #
31
+ #{
32
+ # "appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", <- Also known as the Client ID
33
+ # "displayName": "azure-cli-2018-12-12-14-15-39",
34
+ # "name": "http://azure-cli-2018-12-12-14-15-39",
35
+ # "password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
36
+ # "tenant": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
37
+ #}
38
+ ```
39
+
40
+ NOTE: Don't forget to save the values from the output -- most importantly the `password`.
22
41
 
23
42
  You will also need to ensure you have an active Azure subscription (you can get started [for free](https://azure.microsoft.com/en-us/free/) or use your [MSDN Subscription](https://azure.microsoft.com/en-us/pricing/member-offers/msdn-benefits/)).
24
43
 
@@ -32,22 +51,31 @@ You are now ready to configure kitchen-azurerm to use the credentials from the s
32
51
  Using a text editor, open or create the file ```~/.azure/credentials``` and add the following section, noting there is one section per Subscription ID. **Make sure you save the file with UTF-8 encoding**
33
52
 
34
53
  ```ruby
35
- [abcd1234-YOUR-SUBSCRIPTION-ID-HERE-abcdef123456]
36
- client_id = "48b9bba3-YOUR-GUID-HERE-90f0b68ce8ba"
54
+ [ADD-YOUR-AZURE-SUBSCRIPTION-ID-HERE-IN-SQUARE-BRACKET]
55
+ client_id = "your-azure-client-id-here"
37
56
  client_secret = "your-client-secret-here"
38
- tenant_id = "9c117323-YOUR-GUID-HERE-9ee430723ba3"
57
+ tenant_id = "your-azure-tenant-id-here"
39
58
  ```
40
59
 
41
60
  If preferred, you may also set the following environment variables, however this would be incompatible with supporting multiple Azure subscriptions.
42
61
 
43
62
  ```ruby
44
- AZURE_CLIENT_ID="48b9bba3-YOUR-GUID-HERE-90f0b68ce8ba"
63
+ AZURE_CLIENT_ID="your-azure-client-id-here"
45
64
  AZURE_CLIENT_SECRET="your-client-secret-here"
46
- AZURE_TENANT_ID="9c117323-YOUR-GUID-HERE-9ee430723ba3"
65
+ AZURE_TENANT_ID="your-azure-tenant-id-here"
47
66
  ```
48
67
 
49
68
  Note that the environment variables, if set, take preference over the values in a configuration file.
50
69
 
70
+ After adjusting your ```~/.azure/credentials``` file you will need to adjust your ```kitchen.yml``` file to leverage the azurerm driver. Use the following examples to achieve this, then check your configuration with standard kitchen commands. For example,
71
+
72
+ ```bash
73
+ % kitchen list
74
+ Instance Driver Provisioner Verifier Transport Last Action Last Error
75
+ wsus-windows-2019 Azurerm ChefZero Inspec Winrm <Not Created> <None>
76
+ wsus-windows-2016 Azurerm ChefZero Inspec Winrm <Not Created> <None>
77
+ ```
78
+
51
79
  ### .kitchen.yml example 1 - Linux/Ubuntu
52
80
 
53
81
  Here's an example ```.kitchen.yml``` file that provisions an Ubuntu Server, using Chef Zero as the provisioner and SSH as the transport. Note that if the key does not exist at the specified location, it will be created. Also note that if ```ssh_key``` is supplied, Test Kitchen will use this in preference to any default/configured passwords that are supplied.
@@ -56,7 +84,7 @@ Here's an example ```.kitchen.yml``` file that provisions an Ubuntu Server, usin
56
84
  ---
57
85
  driver:
58
86
  name: azurerm
59
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
87
+ subscription_id: 'your-azure-subscription-id-here'
60
88
  location: 'West Europe'
61
89
  machine_size: 'Standard_D1'
62
90
 
@@ -71,9 +99,6 @@ platforms:
71
99
  driver:
72
100
  image_urn: Canonical:UbuntuServer:14.04.4-LTS:latest
73
101
  vm_name: trusty-vm
74
- vm_tags:
75
- ostype: linux
76
- distro: ubuntu
77
102
 
78
103
  suites:
79
104
  - name: default
@@ -98,7 +123,7 @@ Here's a further example ```.kitchen.yml``` file that will provision a Windows S
98
123
  ---
99
124
  driver:
100
125
  name: azurerm
101
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
126
+ subscription_id: 'your-subscription-id-here'
102
127
  location: 'West Europe'
103
128
  machine_size: 'Standard_DS2_v2'
104
129
 
@@ -113,6 +138,9 @@ platforms:
113
138
  resource_group_tags:
114
139
  project: 'My Cool Project'
115
140
  contact: 'me@somewhere.com'
141
+ vm_tags:
142
+ my_tag: its value
143
+ another_tag: its awesome value
116
144
  transport:
117
145
  name: winrm
118
146
  suites:
@@ -134,7 +162,7 @@ These resources will be created in the same Azure Resource Group as the VM under
134
162
  ---
135
163
  driver:
136
164
  name: azurerm
137
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
165
+ subscription_id: 'your-azure-subscription-id-here'
138
166
  location: 'West Europe'
139
167
  machine_size: 'Standard_D1'
140
168
  pre_deployment_template: predeploy.json
@@ -207,7 +235,7 @@ In this case, the public IP address is not used unless ```public_ip``` is set to
207
235
  ---
208
236
  driver:
209
237
  name: azurerm
210
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
238
+ subscription_id: 'your-azure-subscription-id-here'
211
239
  location: 'West Europe'
212
240
  machine_size: 'Standard_D1'
213
241
 
@@ -241,7 +269,7 @@ Note: The image must be available first. On deletion the disk and everything is
241
269
  ---
242
270
  driver:
243
271
  name: azurerm
244
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
272
+ subscription_id: 'your-azure-subscription-id-here'
245
273
  location: 'West Europe'
246
274
  machine_size: 'Standard_D1'
247
275
 
@@ -282,7 +310,7 @@ This example will:
282
310
  ---
283
311
  driver:
284
312
  name: azurerm
285
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
313
+ subscription_id: 'your-azure-subscription-id-here'
286
314
  location: 'West Europe'
287
315
  machine_size: 'Standard_D1'
288
316
 
@@ -319,7 +347,7 @@ Note: Custom data can be custom data or a file to custom data. Please also note
319
347
  ---
320
348
  driver:
321
349
  name: azurerm
322
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
350
+ subscription_id: 'your-azure-subscription-id-here'
323
351
  location: 'West Europe'
324
352
  machine_size: 'Standard_D1'
325
353
 
@@ -364,7 +392,7 @@ Note the availability of a `format_data_disks` option (default: `false`). When s
364
392
  ---
365
393
  driver:
366
394
  name: azurerm
367
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
395
+ subscription_id: 'your-azure-subscription-id-here'
368
396
  location: 'West Europe'
369
397
  machine_size: 'Standard_F2s'
370
398
 
@@ -403,7 +431,7 @@ These resources will be created in the same Azure Resource Group as the VM under
403
431
  ---
404
432
  driver:
405
433
  name: azurerm
406
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
434
+ subscription_id: 'your-azure-subscription-id-here'
407
435
  location: 'West Europe'
408
436
  machine_size: 'Standard_D1'
409
437
  post_deployment_template: postdeploy.json
@@ -488,7 +516,7 @@ See the [Managed identities for Azure resources](https://docs.microsoft.com/en-u
488
516
  ---
489
517
  driver:
490
518
  name: azurerm
491
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
519
+ subscription_id: 'your-azure-subscription-id-here'
492
520
  location: 'West Europe'
493
521
  machine_size: 'Standard_D1'
494
522
 
@@ -521,7 +549,7 @@ This following example introduces ```secret_url```, ```vault_name```, and ```vau
521
549
  ---
522
550
  driver:
523
551
  name: azurerm
524
- subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
552
+ subscription_id: 'your-azure-subscription-id-here'
525
553
  location: 'CentralUS'
526
554
  machine_size: 'Standard_D2s_v3'
527
555
  secret_url: 'https://YOUR-SECRET-PATH'
@@ -556,7 +584,7 @@ Note that the ```use_managed_disks``` option should be set to false until suppor
556
584
  ---
557
585
  driver:
558
586
  name: azurerm
559
- subscription_id: 'abcdabcd-YOUR-GUID-HERE-abcdabcdabcd'
587
+ subscription_id: 'your-azure-subscription-id-here'
560
588
  azure_environment: 'AzureUSGovernment'
561
589
  location: 'US Gov Iowa'
562
590
  machine_size: 'Standard_D2_v2_Promo'
@@ -616,9 +644,9 @@ data: Canonical UbuntuServer 15.10-DAILY 15.10.201509220 westeurope
616
644
  info: vm image list command OK
617
645
  ```
618
646
 
619
- ### Additional parameters that can be specified
647
+ ### Additional parameters that can be specified in your `kitchen.yml` or added to your personal `kitchen.local.yml`
620
648
 
621
- * Note that the ```driver``` section can also takes a ```username``` and ```password```. The default username is "azure" and the password is a randomly generated 12 character password that can be found in your local kitchen state file (typically .kitchen/<instance-name>.yml) if you require it for any reason.
649
+ * Note that the ```driver``` section can also take explicit values for ```username``` and ```password```. Otherwise, the default username is "azure" and the password is a randomly generated 24 character password that can be found in your local kitchen state file (typically `.kitchen/<instance-name>.yml`) if you require it for any reason.
622
650
 
623
651
  * The ```storage_account_type``` parameter defaults to 'Standard_LRS' and allows you to switch to premium storage (e.g. 'Premium_LRS')
624
652
 
@@ -75,7 +75,7 @@ module Kitchen
75
75
  end
76
76
 
77
77
  default_config(:password) do |_config|
78
- SecureRandom.base64(12)
78
+ SecureRandom.base64(25)
79
79
  end
80
80
 
81
81
  default_config(:vm_name) do |_config|
@@ -225,7 +225,7 @@ module Kitchen
225
225
  end
226
226
 
227
227
  if config[:subscription_id].to_s == ""
228
- raise "A subscription_id config value was not detected and kitchen-azurerm cannot continue. Please check your .kitchen.yml configuration. Exiting."
228
+ raise "A subscription_id config value was not detected and kitchen-azurerm cannot continue. Please check your kitchen.yml configuration. Exiting."
229
229
  end
230
230
 
231
231
  if config[:nic_name].to_s == ""
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-azurerm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Preston
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-06 00:00:00.000000000 Z
11
+ date: 2020-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: azure_mgmt_network
@@ -212,7 +212,7 @@ homepage: https://github.com/test-kitchen/kitchen-azurerm
212
212
  licenses:
213
213
  - Apache-2.0
214
214
  metadata: {}
215
- post_install_message:
215
+ post_install_message:
216
216
  rdoc_options: []
217
217
  require_paths:
218
218
  - lib
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  requirements: []
230
230
  rubygems_version: 3.1.2
231
- signing_key:
231
+ signing_key:
232
232
  specification_version: 4
233
233
  summary: Test Kitchen driver for Azure Resource Manager.
234
234
  test_files: []