azure 0.7.0.pre → 0.7.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.env_sample +3 -1
  3. data/.gitignore +15 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +322 -248
  6. data/Rakefile +3 -1
  7. data/azure.gemspec +18 -14
  8. data/lib/azure.rb +124 -38
  9. data/lib/azure/base_management/base_management_service.rb +57 -69
  10. data/lib/azure/base_management/location.rb +1 -1
  11. data/lib/azure/base_management/management_http_request.rb +55 -58
  12. data/lib/azure/base_management/serialization.rb +5 -0
  13. data/lib/azure/base_management/sql_management_http_request.rb +10 -20
  14. data/lib/azure/blob/auth/shared_access_signature.rb +82 -76
  15. data/lib/azure/blob/blob_service.rb +196 -171
  16. data/lib/azure/client.rb +31 -0
  17. data/lib/azure/client_services.rb +98 -0
  18. data/lib/azure/cloud_service_management/cloud_service_management_service.rb +8 -10
  19. data/lib/azure/configurable.rb +290 -0
  20. data/lib/azure/core/auth/authorizer.rb +1 -1
  21. data/lib/azure/core/auth/shared_key.rb +48 -40
  22. data/lib/azure/core/auth/shared_key_lite.rb +9 -9
  23. data/lib/azure/core/auth/signer.rb +15 -12
  24. data/lib/azure/core/error.rb +2 -3
  25. data/lib/azure/core/filtered_service.rb +4 -3
  26. data/lib/azure/core/http/http_error.rb +10 -12
  27. data/lib/azure/core/http/http_request.rb +82 -69
  28. data/lib/azure/core/http/http_response.rb +12 -56
  29. data/lib/azure/core/http/signer_filter.rb +3 -4
  30. data/lib/azure/core/service.rb +8 -25
  31. data/lib/azure/core/signed_service.rb +7 -5
  32. data/lib/azure/core/utility.rb +45 -6
  33. data/lib/azure/default.rb +126 -0
  34. data/lib/azure/http_client.rb +85 -0
  35. data/lib/azure/queue/queue.rb +0 -1
  36. data/lib/azure/queue/queue_service.rb +6 -4
  37. data/lib/azure/queue/serialization.rb +0 -1
  38. data/lib/azure/service/storage_service.rb +9 -6
  39. data/lib/azure/service_bus/auth/shared_access_signer.rb +44 -0
  40. data/lib/azure/service_bus/auth/wrap_service.rb +5 -4
  41. data/lib/azure/service_bus/auth/wrap_signer.rb +14 -6
  42. data/lib/azure/service_bus/service_bus_service.rb +34 -30
  43. data/lib/azure/sql_database_management/errors.rb +11 -0
  44. data/lib/azure/sql_database_management/firewall_rule.rb +30 -0
  45. data/lib/azure/sql_database_management/serialization.rb +40 -53
  46. data/lib/azure/sql_database_management/sql_database_management_service.rb +141 -130
  47. data/lib/azure/sql_database_management/{sql_database.rb → sql_server.rb} +4 -3
  48. data/lib/azure/storage_management/storage_management_service.rb +9 -10
  49. data/lib/azure/table/auth/shared_key.rb +17 -50
  50. data/lib/azure/table/auth/shared_key_lite.rb +3 -3
  51. data/lib/azure/table/serialization.rb +24 -24
  52. data/lib/azure/table/table_service.rb +21 -18
  53. data/lib/azure/version.rb +1 -1
  54. data/lib/azure/virtual_machine_image_management/virtual_machine_image_management_service.rb +6 -12
  55. data/lib/azure/virtual_machine_management/serialization.rb +4 -1
  56. data/lib/azure/virtual_machine_management/virtual_machine.rb +1 -0
  57. data/lib/azure/virtual_machine_management/virtual_machine_management_service.rb +29 -37
  58. data/lib/azure/virtual_network_management/virtual_network_management_service.rb +5 -6
  59. data/test/fixtures/list_locations.xml +150 -0
  60. data/test/fixtures/list_sql_database.xml +6 -18
  61. data/test/fixtures/list_sql_server_firewall.xml +18 -18
  62. data/test/fixtures/management_certificate.pfx +0 -0
  63. data/test/fixtures/virtual_machine.xml +1 -0
  64. data/test/integration/affinity_group/Create_Affinity_test.rb +1 -1
  65. data/test/integration/affinity_group/Update_Affinity_test.rb +4 -0
  66. data/test/integration/blob/blob_gb18030_test.rb +29 -29
  67. data/test/integration/blob/blob_pages_test.rb +16 -16
  68. data/test/integration/blob/container/create_container_test.rb +6 -6
  69. data/test/integration/blob/container/root_container_test.rb +2 -1
  70. data/test/integration/database/create_sql_server_firewall_test.rb +26 -31
  71. data/test/integration/database/create_sql_server_test.rb +6 -6
  72. data/test/integration/database/delete_sql_server_firewall_test.rb +18 -24
  73. data/test/integration/database/delete_sql_server_test.rb +9 -22
  74. data/test/integration/database/list_sql_server_firewall_test.rb +7 -8
  75. data/test/integration/database/list_sql_servers_test.rb +4 -4
  76. data/test/integration/database/reset_password_sql_server_test.rb +9 -11
  77. data/test/integration/location/RoleSize_List_test.rb +35 -0
  78. data/test/integration/queue/list_queues_test.rb +0 -1
  79. data/test/integration/service_bus/queues_scenario_test.rb +11 -11
  80. data/test/integration/service_bus/queues_test.rb +2 -2
  81. data/test/integration/service_bus/subscriptions_test.rb +25 -25
  82. data/test/integration/service_bus/topics_scenario_test.rb +6 -6
  83. data/test/integration/service_bus/topics_test.rb +15 -15
  84. data/test/integration/table/query_entities_test.rb +1 -0
  85. data/test/integration/table/table_acl_test.rb +9 -9
  86. data/test/integration/test_helper.rb +11 -9
  87. data/test/integration/vm/VM_Create_test.rb +23 -20
  88. data/test/integration/vnet/Virtual_Network_list_test.rb +1 -1
  89. data/test/test_helper.rb +5 -0
  90. data/test/unit/affinity_group/affinity_group_test.rb +4 -4
  91. data/test/unit/base_management/base_management_service_test.rb +19 -0
  92. data/test/unit/base_management/location_test.rb +6 -6
  93. data/test/unit/base_management/role_size_test.rb +50 -0
  94. data/test/unit/blob/auth/shared_access_signature_test.rb +19 -19
  95. data/test/unit/blob/blob_service_test.rb +583 -582
  96. data/test/unit/cloud_service_management/cloud_service_management_service_test.rb +2 -2
  97. data/test/unit/config/azure_test.rb +112 -0
  98. data/test/unit/config/client_test.rb +37 -0
  99. data/test/unit/core/auth/shared_key_lite_test.rb +15 -15
  100. data/test/unit/core/auth/shared_key_test.rb +26 -26
  101. data/test/unit/core/http/http_error_test.rb +13 -14
  102. data/test/unit/core/http/http_request_test.rb +78 -53
  103. data/test/unit/core/http/http_response_test.rb +2 -27
  104. data/test/unit/core/http/retry_policy_test.rb +3 -3
  105. data/test/unit/core/utility_test.rb +122 -0
  106. data/test/unit/database/serialization_test.rb +17 -20
  107. data/test/unit/database/sql_database_server_service_test.rb +97 -40
  108. data/test/unit/http_client_test.rb +74 -0
  109. data/test/unit/service/storage_service_test.rb +105 -101
  110. data/test/unit/storage_management/storage_management_service_test.rb +28 -28
  111. data/test/unit/virtual_machine_image_management/virtual_machine_image_management_service_test.rb +4 -4
  112. data/test/unit/virtual_machine_management/virtual_machine_management_service_test.rb +37 -20
  113. data/test/unit/vnet/virtual_network_management_service_test.rb +1 -1
  114. metadata +91 -20
  115. data/lib/azure/core.rb +0 -41
  116. data/lib/azure/core/configuration.rb +0 -218
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 589f007bd495e8b9975d2564d1d1cf3f26f9fd4c
4
- data.tar.gz: e9d84790d722d659a17083321179fdd9de273727
3
+ metadata.gz: b9dd1d283922e8aa96883838e6d018d17762b0ce
4
+ data.tar.gz: f1acae159ec7febe3a4799b712e9ea34f97f6713
5
5
  SHA512:
6
- metadata.gz: bc90c7ce30f4c6bc1dfc0fc0b286c200da62bc1abd2d14da4f824a5b50a2f33598a41eec960d2d1ecf3cce4b17114e314a5e844a8471f5556fad94b4004bdeda
7
- data.tar.gz: 6432ab91cd8f5010b93a04887cbb714bf5df522b702c16ca23fd300790c420af19b8cb1dbde465c52da59b32a157a9abb2c4783dfff005133b50d00bf1691b1e
6
+ metadata.gz: 4607decea2d04f8178c75817b67370ffacb6d8310a5cc18efd80e4b226ae95471fabe9eb0042e961c3ebd7836d0b8e961011df9432c88febdbbd74d0079ba153
7
+ data.tar.gz: 16e9dd28e7ae27e69b45c77c3fe66fd58b657f920e80c003a1bce4ba7cdb97e58b8ca1e2f678bf22ff30caf0a84d6c6d2269876687561dbf4b3a30777b8a2fef
@@ -8,4 +8,6 @@ AZURE_STORAGE_ACCESS_KEY="your storage access key"
8
8
  AZURE_SERVICEBUS_NAMESPACE="your sb namespace"
9
9
  AZURE_SERVICEBUS_ACCESS_KEY="your sb access key"
10
10
  AZURE_MANAGEMENT_CERTIFICATE="your management cert path"
11
- AZURE_SUBSCRIPTION_ID="your subscription id"
11
+ AZURE_SUBSCRIPTION_ID="your subscription id"
12
+ AZURE_SERVICEBUS_SAS_KEY="Service Bus SAS key"
13
+ AZURE_SERVICEBUS_SAS_KEY_NAME="Service Bus SAS key name"
data/.gitignore CHANGED
@@ -1,4 +1,10 @@
1
1
  .rvmrc
2
+ *.gem
3
+ *.rbc
4
+ *.swp
5
+ *.tmproj
6
+ *~
7
+ .\#*
2
8
  tags
3
9
  /pkg
4
10
  /doc
@@ -7,6 +13,15 @@ nbproject/*
7
13
  *.gem
8
14
  .idea/*
9
15
  .project
16
+ .bundle
17
+ .config
18
+ .yardoc
19
+ _yardoc
20
+ coverage
21
+ doc/
22
+ lib/bundler/man
23
+ pkg
24
+ rdoc
10
25
 
11
26
 
12
27
  .DS_Store
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright [yyyy] [name of copyright owner]
190
+ Copyright 2015 Microsoft Corporation
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -6,45 +6,26 @@
6
6
  This project provides a Ruby package that makes it easy to access and manage Microsoft Azure Services like Storage, Service Bus and Virtual Machines.
7
7
 
8
8
  # Library Features
9
- * Storage
10
- * Blobs
11
- * create, list, and delete containers, work with container metadata and permissions, list blobs in container
12
- * create block and page blobs (from a stream, a file, or a string), work with blob blocks and pages, delete blobs
13
- * work with blob properties, metadata, leases, snapshot a blob
14
- * Tables
15
- * create and delete tables
16
- * create, query, insert, update, merge, and delete entities
17
- * Queues
18
- * create, list, and delete queues, and work with queue metadata
19
- * create, get, peek, update, delete messages
20
- * Service Bus
21
- * Queues
22
- * create, list and delete queues
23
- * send, receive, unlock and delete messages
24
- * Topics
25
- * create, list, and delete topics
26
- * send, receive, unlock and delete messages
27
- * create, list, and delete subscriptions
28
- * create, list, and delete rules
29
- * Base Management
30
- * list locations
31
- * get, list, create, update, delete affinity groups
32
- * Virtual Machine Management
33
- * list images
34
- * list, delete Disks
35
- * Virtual Machines
36
- * create linux based VMs and ssh with cert and key option enabled for ssh and WINRM (both http & https)enabled for windows based VMs
37
- * list, shut down, delete, find virtual machine deployments. While shutting down your VMs the provisioning state would be deallocated and this VM will not be included in the billing cycle.
38
- * Create VM for a specific virtual network
39
- * Cloud Service Management
40
- * create, list, delete cloud services
9
+
10
+ * [Storage](#storage)
11
+ * [Blobs](#blobs)
12
+ * [Tables](#tables)
13
+ * [Queues](#queues)
41
14
  * Storage Account Management
42
- * create, list storage accounts, list locations
43
- * SQL Database Server Management
44
- * list, create SQL Database servers
45
- * reset password for a SQL Database server
46
- * list, set, delete firewall rules for a SQL Database server
47
- * Virtual Network Management
15
+ * [Service Bus](#service-bus)
16
+ * [relays](#relays)
17
+ * [Queues](#sb-queues)
18
+ * [Topics](#topics)
19
+ * [Base Management](#base-mgmt)
20
+ * [Locations](#locations)
21
+ * [Affinity Groups](#affinity)
22
+ * [Virtual Machine Management](#vms)
23
+ * list, delete Disks
24
+ * manage virtual machines
25
+ * [list images](#images)
26
+ * Cloud Service Management
27
+ * [SQL Database Server Management](#sql)
28
+ * [Virtual Network Management](#vnets)
48
29
  * List VNet
49
30
  * Create VNet via parameters or xml file
50
31
 
@@ -55,6 +36,8 @@ This project provides a Ruby package that makes it easy to access and manage Mic
55
36
  * Ruby 2.1
56
37
  * Ruby 2.2
57
38
 
39
+ Note: x64 Ruby for Windows is known to have some compatibility issues.
40
+
58
41
  # Getting Started
59
42
 
60
43
  ## Install the rubygem package
@@ -65,24 +48,6 @@ You can install the azure rubygem package directly.
65
48
  gem install azure
66
49
  ```
67
50
 
68
- ## Download Source Code
69
-
70
- To get the source code of the SDK via **git** just type:
71
-
72
- ```bash
73
- git clone https://github.com/Azure/azure-sdk-for-ruby.git
74
- cd ./azure-sdk-for-ruby
75
- ```
76
- Then, run bundler to install all the gem dependencies:
77
-
78
- ```bash
79
- bundle install
80
- ```
81
-
82
- ## Generate Documentation
83
-
84
- Running the command ``rdoc`` will generate the API documentation in the `./doc` directory.
85
-
86
51
  ## Setup Connection
87
52
 
88
53
  You can use this SDK against the Microsoft Azure Services in the cloud, or against the local Storage Emulator if you are on Windows. Service Bus and Microsoft Azure Service Management emulation are not supported. Of course, to use the Microsoft Azure Services in the cloud, you need to first [create a Microsoft Azure account](http://www.azure.com/en-us/pricing/free-trial/). After that, you can get the information you need to configure Storage and Service Bus from the [Microsoft Azure Portal](https://manage.azure.com).
@@ -92,63 +57,72 @@ There are two ways you can set up the connections:
92
57
  1. [via code](#via-code)
93
58
  2. [via environment variables](#via-environment-variables)
94
59
 
60
+ <a name="via-code"></a>
95
61
  ### Via Code
96
62
  * Against Microsoft Azure Services in the cloud
97
63
 
98
- ```ruby
64
+ ```ruby
65
+
99
66
  require "azure"
100
67
 
101
- Azure.configure do |config|
102
- # Configure these 2 properties to use Storage
103
- config.storage_account_name = "<your azure storage account name>"
104
- config.storage_access_key = "<your azure storage access key>"
105
- # Configure these 3 properties to use Service Bus
106
- config.sb_namespace = "<your azure service bus namespace>"
107
- config.sb_access_key = "<your azure service bus access key>"
108
- config.sb_issuer = "<your azure service bus issuer>"
109
- # Configure these 3 properties to use Service Management. We support passwordless pfx & pem cert formats.
110
- config.management_certificate = "<path to your *.pem or *.pfx>"
111
- config.subscription_id = "<your Subscriptionid>"
112
- config.management_endpoint = "https://management.core.windows.net"
113
- # This property enables/disables SQL Server authentication. By default SQL Server authentication is enabled. SQL Server authentication will also be enabled if you do not set this property
114
- config.sql_database_authentication_mode = <:management_certificate or :sql_server>
115
- # Configure SQL Server authentication API endpoint here
116
- config.sql_database_management_endpoint = "http://management.database.windows.net:8443"
117
- # Configure a ca_cert.pem file if you are having issues with ssl peer verification
118
- config.ca_file = "./ca_file.pem"
119
- end
120
- ```
68
+ Azure.storage_account_name = "<your azure storage account name>"
69
+ Azure.storage_access_key = "<your azure storage access key>"
70
+
71
+ # Configure these 3 properties to use Service Bus
72
+ Azure.sb_namespace = "<your azure service bus namespace>"
73
+ Azure.sb_access_key = "<your azure service bus access key>"
74
+ Azure.sb_issuer = "<your azure service bus issuer>"
75
+
76
+ # Configure these 3 properties to use Service Management. We support passwordless pfx & pem cert formats.
77
+ Azure.management_certificate = "<path to your *.pem or *.pfx>"
78
+ Azure.subscription_id = "<your Subscriptionid>"
79
+
80
+ # Configure a ca_cert.pem file if you are having issues with ssl peer verification
81
+ Azure.ca_file = "./ca_file.pem"
82
+
83
+ # Or create a specific instance of an Azure.client, which will inherit your default configuration settings.
84
+ client = Azure.client(storage_account_name: "your account name", storage_access_key: "your access key")
85
+
86
+ ```
87
+
121
88
  * Against local Emulator (Windows Only)
122
- ```ruby
89
+
90
+ ```ruby
91
+
123
92
  require "azure"
124
93
 
125
- Azure.configure do |config|
126
- # Configure these 2 properties to use local Storage Emulator
127
- config.storage_account_name = "devstoreaccount1"
128
- config.storage_access_key = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
129
- config.storage_blob_host = "http://127.0.0.1:10000/devstoreaccount1"
130
- config.storage_queue_host = "http://127.0.0.1:10001/devstoreaccount1"
131
- config.storage_table_host = "http://127.0.0.1:10002/devstoreaccount1"
132
- # Local Service Bus Emulator is not supported
133
- # Local Service Management emulation is not supported
134
- end
135
- ```
94
+ # Configure these 2 properties to use local Storage Emulator
95
+ Azure.storage_account_name = "devstoreaccount1"
96
+ Azure.storage_access_key = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
97
+
98
+ Azure.storage_blob_host = "http://127.0.0.1:10000/devstoreaccount1"
99
+ Azure.storage_queue_host = "http://127.0.0.1:10001/devstoreaccount1"
100
+ Azure.storage_table_host = "http://127.0.0.1:10002/devstoreaccount1"
101
+
102
+ # Local Service Bus Emulator is not supported
103
+ # Local Service Management emulation is not supported
104
+
105
+ ```
106
+
107
+ <a name="via-environment-variables"></a>
136
108
  ### Via Environment Variables
109
+
137
110
  * Against Microsoft Azure Services in the cloud
138
- * Storage
111
+
112
+ * Storage
139
113
 
140
114
  ```bash
141
115
  AZURE_STORAGE_ACCOUNT = <your azure storage account name>
142
116
  AZURE_STORAGE_ACCESS_KEY = <your azure storage access key>
143
117
  ```
144
- * Service Bus
118
+ * Service Bus
145
119
 
146
120
  ```bash
147
121
  AZURE_SERVICEBUS_NAMESPACE = <your azure service bus namespace>
148
122
  AZURE_SERVICEBUS_ACCESS_KEY = <your azure service bus access key>
149
123
  AZURE_SERVICEBUS_ISSUER = <your azure service bus issuer>
150
124
  ```
151
- * Service Management
125
+ * Service Management
152
126
 
153
127
  ```bash
154
128
  AZURE_MANAGEMENT_CERTIFICATE = <path to *.pem or *.pfx>
@@ -157,13 +131,14 @@ There are two ways you can set up the connections:
157
131
  AZURE_SQL_DATABASE_MANAGEMENT_ENDPOINT = <SQL Database Management Endpoint>
158
132
  AZURE_SQL_DATABASE_AUTHENTICATION_MODE = <:management_certificate or :sql_server>
159
133
  ```
134
+ * [SSL Certificate File](https://gist.github.com/fnichol/867550)
160
135
 
161
- * [SSL Certificate File](https://gist.github.com/fnichol/867550)
162
136
  ```bash
163
137
  SSL_CERT_FILE=<path to *.pem>
164
138
  ```
165
139
  * Against local Emulator (Windows Only)
166
- * Storage
140
+
141
+ * Storage
167
142
 
168
143
  ```bash
169
144
  AZURE_STORAGE_ACCOUNT = devstoreaccount1
@@ -172,190 +147,224 @@ There are two ways you can set up the connections:
172
147
  AZURE_STORAGE_QUEUE_HOST = http://127.0.0.1:10001/devstoreaccount1
173
148
  AZURE_STORAGE_TABLE_HOST = http://127.0.0.1:10002/devstoreaccount1
174
149
  ```
175
- * Service Bus: not supported
176
- * Service Management: not supported
177
- ## Run Test
178
- You can use the following commands to run:
179
- * all the tests: ``rake test``
180
- * a specific suite of tests: ``rake test:integration:blob``
181
- * one particular test file: ``ruby -I"lib:test" "<path of the test file>"``
150
+ * Service Bus: not supported
151
+
152
+ * Service Management: not supported
153
+
182
154
  # Usage
183
- **For more examples, please see the [Microsoft Azure Ruby Developer Center](http://www.azure.com/en-us/develop/ruby)**
155
+
156
+ <a name="storage"></a>
184
157
  ## Storage
185
158
 
186
- ### Blobs
159
+ ### Setup your Storage Credentials
187
160
 
188
161
  ```ruby
162
+
189
163
  # Require the azure rubygem
190
164
  require "azure"
191
165
 
166
+ # Add your default storage credentials
167
+ Azure.storage_account_name = "your account name"
168
+ Azure.storage_access_key = "your access key"
169
+
170
+ # Or create a specific instance of an Azure.client
171
+ client = Azure.client(storage_account_name: "your account name", storage_access_key: "your access key")
172
+
173
+ default_blobs = Azure.blobs # uses the Azure.storage_account_name and Azure.storage_access_key
174
+
175
+ blobs = client.blobs # uses the client.storage_account_name and client.storage_access_key
176
+
177
+ ```
178
+ <a name="blobs"></a>
179
+ ### Blobs
180
+
181
+ ```ruby
182
+
192
183
  # Create an azure storage blob service object
193
- azure_blob_service = Azure::BlobService.new
184
+ blobs = Azure.blobs
194
185
 
195
186
  # Create a container
196
- container = azure_blob_service.create_container("test-container")
187
+ container = blobs.create_container("test-container")
197
188
 
198
189
  # Upload a Blob
199
190
  content = File.open('test.jpg', 'rb') { |file| file.read }
200
- azure_blob_service.create_block_blob(container.name, "image-blob", content)
191
+ blobs.create_block_blob(container.name, "image-blob", content)
201
192
 
202
193
  # List containers
203
- azure_blob_service.list_containers()
194
+ blobs.list_containers()
204
195
 
205
196
  # List Blobs
206
- azure_blob_service.list_blobs(container.name)
197
+ blobs.list_blobs(container.name)
207
198
 
208
199
  # Download a Blob
209
- blob, content = azure_blob_service.get_blob(container.name, "image-blob")
200
+ blob, content = blobs.get_blob(container.name, "image-blob")
210
201
  File.open("download.png", "wb") {|f| f.write(content)}
211
202
 
212
203
  # Delete a Blob
213
- azure_blob_service.delete_blob(container.name, "image-blob")
204
+ blobs.delete_blob(container.name, "image-blob")
205
+
214
206
  ```
207
+ <a name="tables"></a>
215
208
  ### Tables
216
209
 
217
210
  ```ruby
211
+
218
212
  # Require the azure rubygem
219
213
  require "azure"
220
214
 
221
215
  # Create an azure storage table service object
222
- azure_table_service = Azure::TableService.new
216
+ tables = Azure.tables
223
217
 
224
218
  # Create a table
225
- azure_table_service.create_table("testtable")
219
+ tables.create_table("testtable")
226
220
 
227
221
  # Insert an entity
228
222
  entity = { "content" => "test entity", :partition_key => "test-partition-key", :row_key => "1" }
229
- azure_table_service.insert_entity("testtable", entity)
223
+ tables.insert_entity("testtable", entity)
230
224
 
231
225
  # Get an entity
232
- result = azure_table_service.get_entity("testtable", "test-partition-key", "1")
226
+ result = tables.get_entity("testtable", "test-partition-key", "1")
233
227
 
234
228
  # Update an entity
235
229
  result.properties["content"] = "test entity with updated content"
236
- azure_table_service.update_entity(result.table, result.properties)
230
+ tables.update_entity(result.table, result.properties)
237
231
 
238
232
  # Query entities
239
233
  query = { :filter => "content eq 'test entity'" }
240
- result, token = azure_table_service.query_entities("testtable", query)
234
+ result, token = tables.query_entities("testtable", query)
241
235
 
242
236
  # Delete an entity
243
- azure_table_service.delete_entity("testtable", "test-partition-key", "1")
237
+ tables.delete_entity("testtable", "test-partition-key", "1")
244
238
 
245
239
  # delete a table
246
- azure_table_service.delete_table("testtable")
240
+ tables.delete_table("testtable")
241
+
247
242
  ```
243
+
244
+ <a name="queues"></a>
248
245
  ### Queues
249
246
 
250
247
  ```ruby
248
+
251
249
  # Require the azure rubygem
252
250
  require "azure"
253
251
 
254
252
  # Create an azure storage queue service object
255
- azure_queue_service = Azure::QueueService.new
253
+ queues = Azure.queues
256
254
 
257
255
  # Create a queue
258
- azure_queue_service.create_queue("test-queue")
256
+ queues.create_queue("test-queue")
259
257
 
260
258
  # Create a message
261
- azure_queue_service.create_message("test-queue", "test message")
259
+ queues.create_message("test-queue", "test message")
262
260
 
263
261
  # Get one or more messages with setting the visibility timeout
264
- result = azure_queue_service.list_messages("test-queue", 30, {:number_of_messages => 10})
262
+ result = queues.list_messages("test-queue", 30, {:number_of_messages => 10})
265
263
 
266
264
  # Get one or more messages without setting the visibility timeout
267
- result = azure_queue_service.peek_messages("test-queue", {:number_of_messages => 10})
265
+ result = queues.peek_messages("test-queue", {:number_of_messages => 10})
268
266
 
269
267
  # Update a message
270
- message = azure_queue_service.list_messages("test-queue", 30)
271
- pop_receipt, time_next_visible = azure_queue_service.update_message("test-queue", message.id, message.pop_receipt, "updated test message", 30)
268
+ message = queues.list_messages("test-queue", 30)
269
+ pop_receipt, time_next_visible = queues.update_message("test-queue", message.id, message.pop_receipt, "updated test message", 30)
272
270
 
273
271
  # Delete a message
274
- message = azure_queue_service.list_messages("test-queue", 30)
275
- azure_queue_service.delete_message("test-queue", message.id, message.pop_receipt)
272
+ message = queues.list_messages("test-queue", 30)
273
+ queues.delete_message("test-queue", message.id, message.pop_receipt)
276
274
 
277
275
  # Delete a queue
278
- azure_queue_service.delete_queue("test-queue")
276
+ queues.delete_queue("test-queue")
277
+
279
278
  ```
279
+
280
+ <a name="service-bus"></a>
280
281
  ## Service Bus
281
282
 
283
+ <a name="relays"></a>
282
284
  ### Relay
283
285
 
284
286
  ```ruby
287
+
285
288
  # Require the azure rubygem
286
289
  require "azure"
287
290
 
288
291
  # Create an azure service bus object
289
- azure_service_bus = Azure::ServiceBusService.new
292
+ service_bus = Azure.service_bus
290
293
 
291
294
  # Create a relay endpoint with just the endpoint name
292
- relay1 = azure_service_bus.create_relay("test-relay-1", { :relay_type => "Http" })
295
+ relay1 = service_bus.create_relay("test-relay-1", { :relay_type => "Http" })
293
296
 
294
297
  # Create a relay endpoint with a relay object
295
298
  relay2 = Azure::ServiceBus::Relay.new("test-relay-2")
296
299
  relay2.requires_client_authorization = false
297
- relay2 = azure_service_bus.create_relay(relay2)
300
+ relay2 = service_bus.create_relay(relay2)
298
301
 
299
302
  # Delete a relay endpoint
300
- azure_service_bus.delete_relay("test-relay2")
303
+ service_bus.delete_relay("test-relay2")
304
+
301
305
  ```
302
306
 
307
+ <a name="sb-queues"></a>
303
308
  ### Queues
304
309
 
305
310
  ```ruby
311
+
306
312
  # Require the azure rubygem
307
313
  require "azure"
308
314
 
309
315
  # Create an azure service bus object
310
- azure_service_bus = Azure::ServiceBusService.new
316
+ service_bus = Azure.service_bus
311
317
 
312
318
  # Create a queue with just the queue name
313
- queue1 = azure_service_bus.create_queue("test-queue-1")
319
+ queue1 = service_bus.create_queue("test-queue-1")
314
320
 
315
321
  # Create a queue with a queue object
316
322
  queue2 = Azure::ServiceBus::Queue.new("test-queue-2")
317
323
  queue2.max_size_in_megabytes = 2048
318
- queue2 = azure_service_bus.create_queue(queue2)
324
+ queue2 = service_bus.create_queue(queue2)
319
325
 
320
326
  # Send a queue message with just the message body
321
- azure_service_bus.send_queue_message("test-queue-1", "test queue message")
327
+ service_bus.send_queue_message("test-queue-1", "test queue message")
322
328
 
323
329
  # Send a queue message with a brokered message object
324
330
  message = Azure::ServiceBus::BrokeredMessage.new("another test queue message")
325
331
  message.correlation_id = "test-correlation-id-1"
326
- azure_service_bus.send_queue_message("test-queue-1", message)
332
+ service_bus.send_queue_message("test-queue-1", message)
327
333
 
328
334
  # Receive a queue message
329
- message = azure_service_bus.receive_queue_message("test-queue-1")
335
+ message = service_bus.receive_queue_message("test-queue-1")
330
336
 
331
337
  # Delete a queue message
332
- azure_service_bus.delete_queue_message(message)
338
+ service_bus.delete_queue_message(message)
333
339
 
334
340
  # Delete a queue
335
- azure_service_bus.delete_queue("test-queue-1")
341
+ service_bus.delete_queue("test-queue-1")
342
+
336
343
  ```
337
344
 
345
+ <a name="topics"></a>
338
346
  ### Topics
339
347
 
340
348
  ```ruby
349
+
341
350
  # Require the azure rubygem
342
351
  require "azure"
343
352
 
344
353
  # Create an azure service bus object
345
- azure_service_bus = Azure::ServiceBusService.new
354
+ service_bus = Azure.service_bus
346
355
 
347
356
  # Create a topic with just the topic name
348
- topic1 = azure_service_bus.create_topic("test-topic-1")
357
+ topic1 = service_bus.create_topic("test-topic-1")
349
358
 
350
359
  # Create a topic with a topic object
351
360
  topic2 = Azure::ServiceBus::Topic.new("test-topic-2")
352
361
  topic2.max_size_in_megabytes = 2048
353
- topic2 = azure_service_bus.create_topic(topic2)
362
+ topic2 = service_bus.create_topic(topic2)
354
363
 
355
364
  # Create a subscription
356
365
  subscription = Azure::ServiceBus::Subscription.new("test-subscription-1")
357
366
  subscription.topic = topic1.name
358
- subscription = azure_service_bus.create_subscription(subscription)
367
+ subscription = service_bus.create_subscription(subscription)
359
368
 
360
369
  # Send a topic message with just the message body
361
370
  azure_service_bus.send_topic_message(topic1, "test topic message")
@@ -363,58 +372,59 @@ azure_service_bus.send_topic_message(topic1, "test topic message")
363
372
  # Send a topic message with a brokered message object
364
373
  message = Azure::ServiceBus::BrokeredMessage.new("another test topic message")
365
374
  message.correlation_id = "test-correlation-id-1"
366
- azure_service_bus.send_topic_message(topic1, message)
375
+ service_bus.send_topic_message(topic1, message)
367
376
 
368
377
  # Receive a subscription message
369
- message = azure_service_bus.receive_subscription_message(topic1.name, subscription.name)
378
+ message = service_bus.receive_subscription_message(topic1.name, subscription.name)
370
379
 
371
380
  # Delete a subscription message
372
- azure_service_bus.delete_subscription_message(message)
381
+ service_bus.delete_subscription_message(message)
373
382
 
374
383
  # Delete a subscription
375
- azure_service_bus.delete_subscription(subscription)
384
+ service_bus.delete_subscription(subscription)
376
385
 
377
386
  # Delete a topic
378
- azure_service_bus.delete_topic(topic1)
387
+ service_bus.delete_topic(topic1)
388
+
379
389
  ```
390
+
391
+ <a name="vms"></a>
380
392
  ## Virtual Machine Management
381
393
 
382
394
  ```ruby
395
+
383
396
  # Require the azure rubygem
384
397
  require 'azure'
385
398
 
386
- Azure.configure do |config|
387
- # Configure these 3 properties to use Storage
388
- config.management_certificate = "path to *.pem or *.pfx file"
389
- config.subscription_id = "your subscription id"
390
- config.management_endpoint = "https://management.core.windows.net"
391
- end
399
+ # Configure these properties
400
+ Azure.management_certificate = "path to *.pem or *.pfx file"
401
+ Azure.subscription_id = "your subscription id"
392
402
 
393
- #Create a virtual machine service object
394
- virtual_machine_service = Azure::VirtualMachineManagementService.new
403
+ # Create a virtual machine service object
404
+ vm_management = Azure.vm_management
395
405
 
396
- #Get a list of existing virtual machines in your subscription
397
- virtual_machine_service.list_virtual_machines
406
+ # Get a list of existing virtual machines in your subscription
407
+ vm_management.list_virtual_machines
398
408
 
399
- #API to shutdown Virtual Machine
400
- virtual_machine_service.shutdown_virtual_machine('vm_name', 'cloud_service_name')
409
+ # API to shutdown Virtual Machine
410
+ vm_management.shutdown_virtual_machine('vm_name', 'cloud_service_name')
401
411
 
402
- #API to start Virtual Machine
403
- virtual_machine_service.start_virtual_machine('vm_name', 'cloud_service_name')
412
+ # API to start Virtual Machine
413
+ vm_management.start_virtual_machine('vm_name', 'cloud_service_name')
404
414
 
405
- #API to restart Virtual Machine
406
- virtual_machine_service.restart_virtual_machine('vm_name', 'cloud_service_name')
415
+ # API to restart Virtual Machine
416
+ vm_management.restart_virtual_machine('vm_name', 'cloud_service_name')
407
417
 
408
- #API for add disk to Virtual Machine
418
+ # API for add disk to Virtual Machine
409
419
  options = {
410
420
  :disk_label => 'disk-label',
411
421
  :disk_size => 100, #In GB
412
422
  :import => false,
413
423
  :disk_name => 'Disk name' #Required when import is true
414
424
  }
415
- virtual_machine_service.add_data_disk('vm_name', 'cloud_service_name', options)
425
+ vm_management.add_data_disk('vm_name', 'cloud_service_name', options)
416
426
 
417
- #API to add/update Virtual Machine endpoints
427
+ # API to add/update Virtual Machine endpoints
418
428
  endpoint1 = {
419
429
  :name => 'ep-1',
420
430
  :public_port => 996,
@@ -429,15 +439,15 @@ endpoint2 = {
429
439
  :load_balancer_name => ‘lb-ep2’,
430
440
  :load_balancer => {:protocol => 'http', :path => 'hello'}
431
441
  }
432
- virtual_machine_service.update_endpoints('vm_name', 'cloud_service_name', endpoint1, endpoint2)
442
+ vm_management.update_endpoints('vm_name', 'cloud_service_name', endpoint1, endpoint2)
433
443
 
434
- #API to delete Virtual Machine endpoint
435
- virtual_machine_service.delete_endpoint('vm_name', 'cloud_service_name', 'endpoint_name')
444
+ # API to delete Virtual Machine endpoint
445
+ vm_management.delete_endpoint('vm_name', 'cloud_service_name', 'endpoint_name')
436
446
 
437
- #API to delete Virtual Machine
438
- virtual_machine_service.delete_virtual_machine('vm_name', 'cloud_service_name')
447
+ # API to delete Virtual Machine
448
+ vm_management.delete_virtual_machine('vm_name', 'cloud_service_name')
439
449
 
440
- #API to start deployment
450
+ # API to start deployment
441
451
  params = {
442
452
  :vm_name => 'vm_name',
443
453
  :vm_user => 'azureuser',
@@ -447,23 +457,22 @@ params = {
447
457
  }
448
458
  options = {
449
459
  :storage_account_name => 'storage_suse',
450
- :winrm_transport => ['https','http'], #Currently http is supported. To enable https, set the transport protocol to https, simply rdp to the VM once VM is in ready state, export the certificate ( CN name would be the deployment name) from the certstore of the VM and install to your local machine and communicate WinRM via https.
451
460
  :cloud_service_name => 'cloud_service_name',
452
461
  :deployment_name =>'vm_name',
453
462
  :tcp_endpoints => '80,3389:3390',
454
- :private_key_file => 'c:/private_key.key', #required for ssh or winrm(https) certificate.
463
+ :private_key_file => './private_key.key', # required for ssh
455
464
  :ssh_port => 2222,
456
- :vm_size => 'Small', #valid choices are (Basic_A0,Basic_A1,Basic_A2,Basic_A3,Basic_A4,ExtraSmall,Small,Medium,Large,ExtraLarge,A5,A6,A7,A8,A9,Standard_D1,Standard_D2,Standard_D3,Standard_D4,Standard_D11,Standard_D12,Standard_D13,Standard_D14,Standard_DS1,Standard_DS2,Standard_DS3,Standard_DS4,Standard_DS11,Standard_DS12,Standard_DS13,Standard_DS14,Standard_G1,Standard_G2,Standard_G3,Standard_G4,Standard_G5)
465
+ :vm_size => 'Small', # Use any Azure VM size
457
466
  :affinity_group_name => 'affinity1',
458
467
  :virtual_network_name => 'xplattestvnet',
459
468
  :subnet_name => 'subnet1',
460
- :availability_set_name => 'availabiltyset1'
469
+ :availability_set_name => 'availabiltyset1',
461
470
  :reserved_ip_name => 'reservedipname'
462
471
  }
463
- virtual_machine_service.create_virtual_machine(params,options)
472
+ vm_management.create_virtual_machine(params,options)
464
473
 
465
- #API usage to add new roles under cloud service creating VM
466
- #API add_role create multiple roles under the same cloud service. Atleast a single deployment should be created under a hosted service.
474
+ # API usage to add new roles under cloud service creating VM
475
+ # API add_role create multiple roles under the same cloud service. Atleast a single deployment should be created under a hosted service.
467
476
  params = {
468
477
  :vm_name => 'vm_name',
469
478
  :cloud_service_name => 'cloud_service_name',
@@ -473,156 +482,221 @@ params = {
473
482
  }
474
483
  options = {
475
484
  :storage_account_name => 'storage_suse',
476
- :winrm_transport => ['https','http'], #Currently http is supported. To enable https, set the transport protocol to https, simply rdp to the VM once VM is in ready state, export the certificate ( CN name would be the deployment name) from the certstore of the VM and install to your local machine and communicate WinRM via https.
485
+ :winrm_transport => ['https','http'], # Currently http(s) is supported.
477
486
  :tcp_endpoints => '80,3389:3390',
478
- :private_key_file => 'c:/private_key.key', #required for ssh or winrm(https) certificate.
487
+ :private_key_file => './private_key.key', # Required for winrm(https) certificate.
479
488
  :winrm_https_port => 5999,
480
- :winrm_http_port => 6999, #Used to open different powershell port
481
- :vm_size => 'Small', #valid choices are (Basic_A0,Basic_A1,Basic_A2,Basic_A3,Basic_A4,ExtraSmall,Small,Medium,Large,ExtraLarge,A5,A6,A7,A8,A9,Standard_D1,Standard_D2,Standard_D3,Standard_D4,Standard_D11,Standard_D12,Standard_D13,Standard_D14,Standard_DS1,Standard_DS2,Standard_DS3,Standard_DS4,Standard_DS11,Standard_DS12,Standard_DS13,Standard_DS14,Standard_G1,Standard_G2,Standard_G3,Standard_G4,Standard_G5)
489
+ :winrm_http_port => 6999, # Used to open different powershell port
490
+ :vm_size => 'Small', # Use any Azure VM size
482
491
  :availability_set_name => 'availabiltyset'
483
492
  }
484
- virtual_machine_service.add_role(params, options)
493
+ vm_management.add_role(params, options)
494
+
495
+ ```
496
+
497
+ <a name="images"></a>
498
+ ## List Images
499
+
500
+ ```ruby
485
501
 
486
- #Get a list of available virtual machine images
487
- virtual_machine_image_service = Azure::VirtualMachineImageManagementService.new
488
- virtual_machine_image_service.list_virtual_machine_images
502
+ # Get a list of available virtual machine images
503
+ vm_image_management = Azure.vm_image_management
504
+ vm_image_management.list_virtual_machine_images
489
505
 
490
- #Get a list of available regional data center locations
491
- base_management = Azure::BaseManagementService.new
506
+ ```
507
+
508
+ <a name="base-mgmt"></a>
509
+ ## Base Management
510
+
511
+ <a name="locations"></a>
512
+ ```ruby
513
+
514
+ # Get a list of available regional data center locations
515
+ base_management = Azure.base_management
492
516
  base_management.list_locations
517
+
493
518
  ```
494
- ## Affinity Group Management
519
+
520
+ <a name="affinity"></a>
521
+ ### Affinity Group Management
495
522
 
496
523
  ```ruby
524
+
497
525
  # Require the azure rubygem
498
526
  require 'azure'
499
527
 
500
- #Create a affinity group service object
501
- base_management_service = Azure::BaseManagementService.new
528
+ # Create a affinity group service object
529
+ base_management = Azure.base_management
502
530
 
503
- #Get a list of affinity group that are provisioned for a subscription.
504
- base_management_service.list_affinity_groups
531
+ # Get a list of affinity group that are provisioned for a subscription.
532
+ base_management.list_affinity_groups
505
533
 
506
- #API to delete affinity group
507
- base_management_service.delete_affinity_group('affinity-group-name')
534
+ # API to delete affinity group
535
+ base_management.delete_affinity_group('affinity-group-name')
508
536
 
509
- #API to add a new affinity group to a subscription
537
+ # API to add a new affinity group to a subscription
510
538
  options = {:description => 'Some Description'}
511
- base_management_service.create_affinity_group('affinity-group-name', 'West US', 'Label Name', options)
539
+ base_management.create_affinity_group('affinity-group-name', 'West US', 'Label Name', options)
512
540
 
513
- #API to update affinity group
541
+ # API to update affinity group
514
542
  options = {:description => 'Some Description'}
515
- base_management_service.update_affinity_group('affinity-group-name', 'Label Name', options)
543
+ base_management.update_affinity_group('affinity-group-name', 'Label Name', options)
544
+
545
+ # API to list properties associated with the specified affinity group
546
+ base_management.get_affinity_group('affinity-group-name')
516
547
 
517
- #API to list properties associated with the specified affinity group
518
- base_management_service.get_affinity_group('affinity-group-name')
519
548
  ```
549
+
550
+ <a name="sql"></a>
520
551
  ## SQL Database Server Management
521
552
 
522
553
  ```ruby
554
+
523
555
  # Require the azure rubygem
524
556
  require 'azure'
525
557
 
526
- Azure.configure do |config|
527
- config.management_certificate = "path to *.pem or *.pfx file"
528
- config.subscription_id = "your subscription id"
529
- config.management_endpoint = "https://management.database.windows.net:8443/"
530
- #To access other service management apis use "https://management.core.windows.net".
531
- end
558
+ # Configure these properties
559
+ Azure.management_certificate = "path to *.pem or *.pfx file"
560
+ Azure.subscription_id = "your subscription id"
532
561
 
533
- #Create a database server service object
534
- sql_db_service = Azure::SqlDatabaseManagementService.new
562
+ # Create a database server service object
563
+ sql_db_service = Azure.sql_database_management
535
564
 
536
- #Get a list of SQL Database servers that are provisioned for a subscription.
565
+ # Get a list of SQL Database servers that are provisioned for a subscription.
537
566
  sql_db_service.list_servers
538
567
 
539
- #API to delete SQL Database server
568
+ # API to delete SQL Database server
540
569
  sql_db_service.delete_server('server_name')
541
570
 
542
- #API to adds a new SQL Database server to a subscription
571
+ # API to adds a new SQL Database server to a subscription
543
572
  sql_db_service.create_server('admin-login', 'ComplexPassword', 'West US')
544
573
 
545
- #API to sets the administrative password of a SQL Database server for a subscription
574
+ # API to sets the administrative password of a SQL Database server for a subscription
546
575
  sql_db_service.reset_password('server-name', 'NewPassword')
547
576
 
548
- #Get a list of all the server-level firewall rules for a SQL Database server that belongs to a subscription
577
+ # Get a list of all the server-level firewall rules for a SQL Database server that belongs to a subscription
549
578
  sql_db_service.list_sql_server_firewall_rules("server-name")
550
579
 
551
- #API to adds a new server-level firewall rule or updates an existing server-level firewall rule for a SQL Database server with requester’s IP address.
580
+ # API to adds a new server-level firewall rule or updates an existing server-level firewall rule for a SQL Database server with requester’s IP address.
552
581
  sql_db_service.delete_sql_server_firewall_rule("server-name", "rule-name")
553
582
 
554
- #API to add/updates server-level firewall rule for a SQL Database server that belongs to a subscription
583
+ # API to add/updates server-level firewall rule for a SQL Database server that belongs to a subscription
555
584
  ip_range = {:start_ip_address => "0.0.0.1", :end_ip_address => "0.0.0.5"}
556
585
  sql_db_service.set_sql_server_firewall_rule("server-name", "rule-name", ip_range)
557
586
 
558
587
  # If ip_range was not specified in the above api then the IP of the machine from where the api is being called would be set as the rule.
559
588
  # To toggle between the option to allow Microsoft Azure services to access db server similar to azure portal just set the fire wall rule
560
589
  # with iprange to be 0.0.0.0 as start and end.Remove the rule to unset this option.
590
+
561
591
  ```
592
+
593
+ <a name="vnets"></a>
562
594
  ## Virtual Network Management
563
595
 
564
596
  ```ruby
597
+
565
598
  # Require the azure rubygem
566
599
  require 'azure'
567
600
 
568
- #Create a virtual network service object
569
-
570
- vnet = Azure::VirtualNetworkManagementService.new
571
-
572
- #API to get a list of virtual networks created for a subscription.
601
+ # Create a virtual network service object
602
+ vnet = Azure.network_management
573
603
 
604
+ # API to get a list of virtual networks created for a subscription.
574
605
  vnet.list_virtual_networks
575
606
 
576
- #API to configure virtual network with required and optional parameters
577
-
607
+ # API to configure virtual network with required and optional parameters
578
608
  address_space = ['172.16.0.0/12', '10.0.0.0/8', '192.168.0.0/24']
579
-
580
609
  subnets = [{:name => 'subnet-1', :ip_address=>'172.16.0.0', :cidr=>12}, {:name => 'subnet-2', :ip_address=>'10.0.0.0', :cidr=>8}]
581
-
582
610
  dns_servers = [{:name => 'dns-1', :ip_address=>'1.2.3.4'}, {:name => 'dns-2', :ip_address=>'8.7.6.5'}]
583
-
584
611
  options = {:subnet => subnets, :dns => dns_servers}
585
-
586
612
  vnet.set_network_configuration('virtual-network-name', 'location_name', address_space, options)
587
613
 
588
- #API to configure virtual network from xml file that can be exported from management portal and customized to add or delete vnet
589
-
614
+ # API to configure virtual network from xml file that can be exported from management portal and customized to add or delete vnet
590
615
  vnetxml = './customnetwork.xml'
591
-
592
616
  vnet.set_network_configuration(vnetxml)
617
+
593
618
  ```
594
619
 
595
- # Useful commands for certificate operations
620
+ # Getting Started with Certificates
596
621
 
597
622
  Currently the sdk supports *.pem or *.pfx (passwordless pfx) for service management operations. Following are the steps discussed on various cert operations.
598
623
 
599
- ## Publish Settings files
624
+ ## Get Started with Publish Settings
600
625
 
601
626
  * To create a pfx from the publishsettings, simply download the publishsettings file for your subscription
602
627
  [https://manage.windowsazure.com/publishsettings](https://manage.windowsazure.com/publishsettings/index?client=powershell). Make sure you have this gem installed and
603
628
  run `pfxer --in [path to your .publishsettings file]`. This will create a .pfx from your publish settings file which can
604
629
  be supplied as a cert parameter for Service Management Commands.
605
630
 
606
- ## Generate New Cert and Upload to Azure Portal
631
+ ## Get Started with OpenSSL
607
632
 
608
633
  * Using the following openssl commands to create a cert and upload to Azure Management
609
- * Generate public and private `openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.key -out mycert.pem`
610
- * Generate public .cer for Azure upload `openssl x509 -inform pem -in mycert.pem -outform der -out mycert_mgmt.cer`
611
- * Upload the `mycert_mgmt.cer` to Azure Management through [https://management.azure.com](https://management.azure.com)
612
- * Combine the public and private into one `cat mycert.key mycert.pem > cert.pem`
634
+ * Generate public and private `openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout cert.pem -out cert.pem`
635
+ * Generate public .cer for Azure upload `openssl x509 -inform pem -in cert.pem -outform der -out mgmt.cer`
636
+ * Upload the `mgmt.cer` to Azure Management through [https://management.azure.com](https://management.azure.com)
613
637
  * Use cert.pem as your cert parameter for Service Management Commands.
614
638
 
615
- # Need Help?
639
+ # Contribute Code or Provide Feedback
616
640
 
617
- Be sure to check out the Microsoft Azure [Developer Forums on Stack Overflow and MSDN](http://go.microsoft.com/fwlink/?LinkId=234489) if you have trouble with the provided code.
641
+ 1. Fork it
642
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
643
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
644
+ 4. Push to the branch (`git push origin my-new-feature`)
645
+ 5. Create new Pull Request
618
646
 
619
- # Contribute Code or Provide Feedback
620
647
 
621
- If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](http://azure.github.com/guidelines.html).
648
+ ## Development Environment Setup
649
+
650
+ ### Download Source Code
651
+
652
+ To get the source code of the SDK via **git** just type:
653
+
654
+ ```bash
655
+ git clone https://github.com/Azure/azure-sdk-for-ruby.git
656
+ cd ./azure-sdk-for-ruby
657
+ ```
658
+
659
+ Then, run bundler to install all the gem dependencies:
660
+
661
+ ```bash
662
+ bundle install
663
+ ```
664
+
665
+ ### Setup the Environment for Integration Tests
666
+
667
+ If you would like to run the integration test suite, you will need to setup environment variables which will be used
668
+ during the integration tests. These tests will use these credentials to run live tests against Azure with the provided
669
+ credentials (you will be charged for usage, so verify the clean up scripts did their job at the end of a test run).
670
+
671
+ The root of the project contains a .env_sample file. This dot file is a sample of the actual environment vars needed to
672
+ run the integration tests.
673
+
674
+ Do the following to prepare your environment for integration tests:
675
+
676
+ * Copy .env_sample to .env **relative to root of the project dir**
677
+ * Update .env with your credentials **.env is in the .gitignore, so should only reside locally**
678
+
679
+ ### Run Tests
680
+
681
+ You can use the following commands to run:
682
+
683
+ * All the tests: ``rake test``. **This will run integration tests if you have .env file or env vars setup**
684
+ * A specific suite of tests: ``rake test:unit``, ``rake test:integration``, ``rake test:integration:blob``, etc.
685
+ * one particular test file: ``ruby -I"lib:test" "<path of the test file>"``
686
+
687
+ ### Generate Documentation
688
+
689
+ Running the command ``yard`` will generate the API documentation in the `./doc` directory.
690
+
691
+ ## Provide Feedback
692
+
622
693
  If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-ruby/issues) section of the project.
623
694
 
624
- # Learn More
695
+ # Maintainers
696
+
697
+ * [David Justice](https://github.com/devigned)
698
+
699
+ # Azure CLI Tooling
625
700
 
626
- For documentation on how to host Ruby applications on Microsoft Azure, please see the [Microsoft Azure Ruby Developer Center](http://www.azure.com/en-us/develop/ruby/).
627
- For documentation on Azure PowerShell CLI tool for Windows, please see our readme [here](http://github.com/azure/azure-sdk-tools).
628
- For documentation on the Azure cross platform CLI tool for Windows, Mac and Linux, please see our readme [here](http://github.com/azure/azure-sdk-tools-xplat).
701
+ For documentation on [Azure PowerShell](http://github.com/azure/azure-powershell).
702
+ For documentation on [Azure CLI](http://github.com/azure/azure-xplat-cli).