Script to create container and populate on Mac

Scott Cable 60 Reputation points
2024-04-10T14:34:42.1533333+00:00

Just to bring your attention to a issue with mslearn-knowledge-mining/Labfiles/01-azure-search/ Lab for Mac users - the only method provided by the exercise to create a container and populate it is via a script that doesn't run on Mac by default.

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
720 questions
{count} votes

Accepted answer
  1. ajkuma 22,416 Reputation points Microsoft Employee
    2024-04-23T12:52:55.04+00:00

    Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer. They can only accept answers by others, I' have summarized and posted the solution, request you to Accept the answer, it will benefit the community find the answers quickly.

    @scott cable - Thanks for sharing the solution.

    Question:

    MS Learn lab for knowledge mining on Azure Search provided method is to create a container and populate it doesn't work on Mac by default.

    Solution is to replace the .cmd script with the following .sh script:

    #!/bin/bash
    # Enable the script to exit immediately on error
    set -e
    
    # Set values for your storage account
    subscription_id="<subscription_id>"
    azure_storage_account="<azure_storage_account>"
    azure_storage_key="<azure_storage_key>"
    
    echo "Creating container..."
    az storage container create --account-name "$azure_storage_account" --subscription "$subscription_id" --name margies --public-access blob --auth-mode key --account-key "$azure_storage_key" --output none
    
    echo "Uploading files..."
    az storage blob upload-batch -d margies -s data --account-name "$azure_storage_account" --auth-mode key --account-key "$azure_storage_key" --output none
    
    
    

     If the answer helped (pointed you in the right direction) > please click Accept Answer - it will benefit the community to find the answers quickly.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Scott Cable 60 Reputation points
    2024-04-22T12:57:17.8833333+00:00

    Solution is to replace the .cmd script with the following .sh script:

    #!/bin/bash
    # Enable the script to exit immediately on error
    set -e
    
    # Set values for your storage account
    subscription_id="<subscription_id>"
    azure_storage_account="<azure_storage_account>"
    azure_storage_key="<azure_storage_key>"
    
    echo "Creating container..."
    az storage container create --account-name "$azure_storage_account" --subscription "$subscription_id" --name margies --public-access blob --auth-mode key --account-key "$azure_storage_key" --output none
    
    echo "Uploading files..."
    az storage blob upload-batch -d margies -s data --account-name "$azure_storage_account" --auth-mode key --account-key "$azure_storage_key" --output none