Skip to content

Commit

Permalink
Passing Default Storage for avoiding workspace network setting polici…
Browse files Browse the repository at this point in the history
…es (#3449)

* Passing Default Storage for avoiding workspace network setting policies

* trying quick fix

* fix

* fix
  • Loading branch information
vaibhj authored Dec 2, 2024
1 parent 896955c commit 7b454e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sdk/python/jobs/spark/setup_spark.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <create_variables>
SUBSCRIPTION_ID=$(az account show --query id -o tsv)
LOCATION=$(az ml workspace show --query location -o tsv)
LOCATION="eastus"
RESOURCE_GROUP=$(az group show --query name -o tsv)
AML_WORKSPACE_NAME=$(az configure -l --query "[?name=='workspace'].value" -o tsv)
API_VERSION="2022-05-01"
Expand Down Expand Up @@ -48,13 +48,16 @@ AML_USER_MANAGED_ID_OID=$(az identity show --resource-group $RESOURCE_GROUP -n $
#<setup_vnet_resources>
if [[ "$2" == *"managed_vnet"* ]]
then
TIMESTAMP=`date +%m%d%H%M%S`
TIMESTAMP=`date +%m%d%H%M`
AML_WORKSPACE_NAME=${AML_WORKSPACE_NAME}-vnet-$TIMESTAMP
AZURE_STORAGE_ACCOUNT=${RESOURCE_GROUP}blobvnet
DEFAULT_STORAGE_ACCOUNT="sparkdefaultvnet"
BLOB_CONTAINER_NAME="blobstoragevnetcontainer"
GEN2_STORAGE_ACCOUNT_NAME=${RESOURCE_GROUP}gen2vnet
ADLS_CONTAINER_NAME="gen2containervnet"

az storage account create -n $DEFAULT_STORAGE_ACCOUNT -g $RESOURCE_GROUP -l $LOCATION --sku Standard_LRS

az storage account create -n $AZURE_STORAGE_ACCOUNT -g $RESOURCE_GROUP -l $LOCATION --sku Standard_LRS
az storage container create -n $BLOB_CONTAINER_NAME --account-name $AZURE_STORAGE_ACCOUNT

Expand All @@ -80,7 +83,8 @@ then
s/<ACCESS_KEY_SECRET_NAME>/$ACCESS_KEY_SECRET_NAME/g;
s/<BLOB_CONTAINER_NAME>/$BLOB_CONTAINER_NAME/g;
s/<GEN2_STORAGE_ACCOUNT_NAME>/$GEN2_STORAGE_ACCOUNT_NAME/g;
s/<ADLS_CONTAINER_NAME>/$ADLS_CONTAINER_NAME/g;" $2
s/<ADLS_CONTAINER_NAME>/$ADLS_CONTAINER_NAME/g
s/<DEFAULT_STORAGE_ACCOUNT>/$DEFAULT_STORAGE_ACCOUNT/g;" $2
#</setup_vnet_resources>
#<setup_interactive_session_resources>
elif [[ "$2" == *"run_interactive_session_notebook"* ]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,17 @@
"region = \"<AZURE_REGION_NAME>\"\n",
"# Enter Azure Blob storage account name for the outbound rule\n",
"blob_storage_account = \"<STORAGE_ACCOUNT_NAME>\"\n",
"default_storage_account = \"<DEFAULT_STORAGE_ACCOUNT>\"\n",
"\n",
"default_storage_resource_id = f\"/subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.Storage/storageAccounts/{default_storage_account}\"\n",
"\n",
"ws_mvnet = Workspace(\n",
" name=ws_name,\n",
" location=region,\n",
" hbi_workspace=False,\n",
" public_network_access=\"Disabled\", # Comment this out to enable Public Network Access\n",
" tags=dict(purpose=\"demo\"),\n",
" storage_account=default_storage_resource_id,\n",
")\n",
"\n",
"ws_mvnet.managed_network = ManagedNetwork(\n",
Expand Down

0 comments on commit 7b454e6

Please sign in to comment.