Skip to content

Commit

Permalink
The Azure provider and SDK can be worked correctly for AzureChinaCloud
Browse files Browse the repository at this point in the history
  • Loading branch information
taiojia committed Jul 10, 2015
1 parent 9e8b68a commit 12153f1
Show file tree
Hide file tree
Showing 27 changed files with 18,091 additions and 5 deletions.
30 changes: 30 additions & 0 deletions azure/initialization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# The MIT License (MIT)
#
# Copyright (c) 2015 Taio Jia (jiasir) <jiasir@icloud.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR

from azure.servicemanagement import ServiceManagementService

subscription_id = '7f32b7c7-8622-4070-84d0-1ec5bc64dd8f'
cert_file = '/Users/Taio/Downloads/Microsoft_Azure_credentials.pem'
sms = ServiceManagementService(subscription_id, cert_file)

locations = sms.list_locations()
for location in locations:
print(location.name)
29 changes: 29 additions & 0 deletions azure/publish_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# The MIT License (MIT)
#
# Copyright (c) 2015 Taio Jia (jiasir) <jiasir@icloud.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from azure.servicemanagement import get_certificate_from_publish_settings

subscription_id = get_certificate_from_publish_settings(
publish_settings_path='/Users/Taio/Downloads/Microsoft_Azure_credentials.publishsettings',
path_to_write_certificate='/Users/Taio/Downloads/Microsoft_Azure_credentials.pem',
subscription_id='7f32b7c7-8622-4070-84d0-1ec5bc64dd8f',
)
1 change: 0 additions & 1 deletion bin/tests/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion get_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# Install azure library
try:
os.system('sudo /usr/local/bin/pip2.7 install azure')
except:
except Exception:
os.system('sudo pip install azure')


Expand Down
Loading

0 comments on commit 12153f1

Please sign in to comment.