|
| 1 | +""" |
| 2 | +Copyright (C) Microsoft Corporation. All rights reserved. |
| 3 | + |
| 4 | +Microsoft Corporation (“Microsoft”) grants you a nonexclusive, perpetual, |
| 5 | +royalty-free right to use, copy, and modify the software code provided by us |
| 6 | +("Software Code"). You may not sublicense the Software Code or any use of it |
| 7 | +(except to your affiliates and to vendors to perform work on your behalf) |
| 8 | +through distribution, network access, service agreement, lease, rental, or |
| 9 | +otherwise. This license does not purport to express any claim of ownership over |
| 10 | +data you may have shared with Microsoft in the creation of the Software Code. |
| 11 | +Unless applicable law gives you more rights, Microsoft reserves all other |
| 12 | +rights not expressly granted herein, whether by implication, estoppel or |
| 13 | +otherwise. |
| 14 | + |
| 15 | +THE SOFTWARE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 16 | +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | +MICROSOFT OR ITS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 19 | +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 20 | +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 21 | +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 22 | +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 23 | +ARISING IN ANY WAY OUT OF THE USE OF THE SOFTWARE CODE, EVEN IF ADVISED OF THE |
| 24 | +POSSIBILITY OF SUCH DAMAGE. |
| 25 | +""" |
| 26 | +import os, json, sys |
| 27 | +from azureml.core import Workspace |
| 28 | +from azureml.core.authentication import AzureCliAuthentication |
| 29 | + |
| 30 | +cli_auth = AzureCliAuthentication() |
| 31 | + |
| 32 | +# Get workspace |
| 33 | +ws = Workspace.from_config(auth=cli_auth) |
| 34 | + |
| 35 | +# Get the latest image details |
| 36 | +latest_image = ws.images |
| 37 | +name, version = latest_image.get(list(latest_image)[0]).id.split(':') |
| 38 | + |
| 39 | +# Writing the image details to /aml_config/image.json |
| 40 | +image_json = {} |
| 41 | +image_json["image_name"] = name |
| 42 | +image_json["image_version"] = version |
| 43 | +with open("aml_config/image.json", "w") as outfile: |
| 44 | + json.dump(image_json, outfile) |
0 commit comments