Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Deploy, evaluate, and manage AI agents end-to-end on Microsoft Azure AI Foundry
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
models/deploy-model/scripts/generate_deployment_url.sh
1#!/bin/bash2# Generate Azure AI Foundry portal URL for a model deployment3# This script creates a direct clickable link to view a deployment in the Azure AI Foundry portal45set -e67# Function to display usage8usage() {9cat << EOF10Usage: $0 --subscription SUBSCRIPTION_ID --resource-group RESOURCE_GROUP \\11--foundry-resource FOUNDRY_RESOURCE --project PROJECT_NAME \\12--deployment DEPLOYMENT_NAME1314Generate Azure AI Foundry deployment URL1516Required arguments:17--subscription Azure subscription ID (GUID)18--resource-group Resource group name19--foundry-resource Foundry resource (account) name20--project Project name21--deployment Deployment name2223Example:24$0 --subscription d5320f9a-73da-4a74-b639-83efebc7bb6f \\25--resource-group bani-host \\26--foundry-resource banide-host-resource \\27--project banide-host \\28--deployment text-embedding-ada-00229EOF30exit 131}3233# Parse command line arguments34while [[ $# -gt 0 ]]; do35case $1 in36--subscription)37SUBSCRIPTION_ID="$2"38shift 239;;40--resource-group)41RESOURCE_GROUP="$2"42shift 243;;44--foundry-resource)45FOUNDRY_RESOURCE="$2"46shift 247;;48--project)49PROJECT_NAME="$2"50shift 251;;52--deployment)53DEPLOYMENT_NAME="$2"54shift 255;;56-h|--help)57usage58;;59*)60echo "Unknown option: $1"61usage62;;63esac64done6566# Validate required arguments67if [ -z "$SUBSCRIPTION_ID" ] || [ -z "$RESOURCE_GROUP" ] || [ -z "$FOUNDRY_RESOURCE" ] || \68[ -z "$PROJECT_NAME" ] || [ -z "$DEPLOYMENT_NAME" ]; then69echo "Error: Missing required arguments"70usage71fi7273# Convert subscription GUID to bytes (big-endian/string order) and encode as base64url74# Remove hyphens from GUID75GUID_HEX=$(echo "$SUBSCRIPTION_ID" | tr -d '-')7677# Convert hex string to bytes and base64 encode78# Using xxd to convert hex to binary, then base64 encode79ENCODED_SUB=$(echo "$GUID_HEX" | xxd -r -p | base64 | tr '+' '-' | tr '/' '_' | tr -d '=')8081# Build the encoded resource path82# Format: {encoded-sub-id},{resource-group},,{foundry-resource},{project-name}83# Note: Two commas between resource-group and foundry-resource84ENCODED_PATH="${ENCODED_SUB},${RESOURCE_GROUP},,${FOUNDRY_RESOURCE},${PROJECT_NAME}"8586# Build the full URL87BASE_URL="https://ai.azure.com/nextgen/r/"88DEPLOYMENT_PATH="/build/models/deployments/${DEPLOYMENT_NAME}/details"8990echo "${BASE_URL}${ENCODED_PATH}${DEPLOYMENT_PATH}"91