<jupyter_start><jupyter_text>Copyright © 2021, SAS Institute Inc., Cary, NC, USA.  All Rights Reserved. SPDX-License-Identifier: Apache-2.0  Configure an Azure Machine Learning Container Publishing DestinationIn order to create an Azure Machine Learning (AML) destination, you must complete the following steps:1. Establish a connection and define URLs.2. Get an authorization token.3. Submit an API post to create an Azure Machine Learning destination.  Establish a Connection and Define URLs<jupyter_code>import sys
sys.path.append('..')
import mmAuthorization

import requests
import json, os, pprint
import base64
host_name= "localhost"
port = "8080"

host_url="http://" + host_name + ":" + port
destination_url = host_url + "/modelPublish/destinations/"
print(host_url)<jupyter_output><empty_output><jupyter_text>Get an Authorization Token and Define Headers<jupyter_code>mm_auth = mmAuthorization.mmAuthorization("myAuth")

admin_userId = '<SAS_user_admin_ID>'
user_passwd =  '<<PASSWORD>>'

admin_auth_token = mm_auth.get_auth_token(host_url, admin_userId, user_passwd)

destination_aml_headers = {
    "If-Match":"false",
    "Content-Type":"application/vnd.sas.models.publishing.destination.aml+json",
    mmAuthorization.AUTHORIZATION_HEADER: mmAuthorization.AUTHORIZATION_TOKEN + admin_auth_token
}

print(admin_auth_token)<jupyter_output><empty_output><jupyter_text>Create an AML Destination<jupyter_code>dest_name = '<Destination_Name>'
baseRepoUrl = '<AML_Container_Registry_Base_URL>'

subscriptionId = '<Azure_Subscription_ID>'
region = '<AML_Region_Value>'   # default value is eastus
destination_attrs = {
    'name': dest_name,
    'destinationType': 'aml',
    'properties': [
                   {"name": "baseRepoUrl", "value": baseRepoUrl},
                   {'name': "subscriptionId", "value": subscriptionId},
                   {'name': "region", "value": region}]}

destination = requests.post(destination_url, 
                       data=json.dumps(destination_attrs), headers=destination_aml_headers)

print(destination)
pprint.pprint(destination.json())<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11021759697256386, 'fraction_numerical': 0.007095553453169348, 'mean_word_length': 5.428571428571429, 'pattern_counts': {'":': 7, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '102794', 'license': 'Apache-2.0', 'n_tokens_mistral': 653, 'n_tokens_neox': 644, 'n_words': 147, 'path': 'addons/destinations/CreateAMLDestination.ipynb', 'repo_name': 'SophiaRowland/open-model-manager-resources', 'size': '2121'}