Skip to content

Commit

Permalink
Minor script syntax changes and Readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
devkelley committed Nov 21, 2023
1 parent ff54d86 commit f54165e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 60 deletions.
8 changes: 4 additions & 4 deletions cloud_connectors/azure/digital_twins_connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sudo apt install dotnet-sdk-6.0

### Automated Azure Digital Twins Setup

Before starting this section, please view [Prerequisites for Automated Deployment of Azure Resources](../README.md#prerequisites-for-automated-deployment-of-azure-resources).
Before starting this section, please read [Prerequisites for Automated Deployment of Azure Resources](../README.md#prerequisites-for-automated-deployment-of-azure-resources).

1. Sign in with Azure CLI. Follow the prompts after entering the following command.

Expand All @@ -33,12 +33,12 @@ az login --use-device-code
```shell
cd {freyja-root-dir}/cloud_connectors/azure/scripts
chmod +x digital_twins_setup.sh
./digital_twins_setup.sh -r myRG -l westus2 -d myADT
./digital_twins_setup.sh -r {myRG} -l westus2 -d {myADT}
```

### Automated Azure Digital Twins Setup for Smart Trailer Example

Before starting this section, please view [Prerequisites for Automated Deployment of Azure Resources](../README.md#prerequisites-for-automated-deployment-of-azure-resources).
Before starting this section, please read [Prerequisites for Automated Deployment of Azure Resources](../README.md#prerequisites-for-automated-deployment-of-azure-resources).

1. Sign in with Azure CLI. Follow the prompts after entering the following command.

Expand All @@ -51,7 +51,7 @@ az login --use-device-code
```shell
cd {freyja-root-dir}/cloud_connectors/azure/scripts
chmod +x digital_twins_setup_smart_trailer.sh
./digital_twins_setup.sh -r myRG -l westus2 -d myADT
./digital_twins_setup.sh -r {myRG} -l westus2 -d {myADT}
```

### Manual Azure Digital Twins Setup
Expand Down
56 changes: 28 additions & 28 deletions cloud_connectors/azure/scripts/digital_twins_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,33 @@ usage() {
# Parse command line arguments
while [[ $# -gt 0 ]]
do
key="$1"
key="$1"

case $key in
-r|--resource-group-name)
resource_group="$2"
shift # past argument
shift # past value
;;
-l|--location)
location="$2"
shift # past argument
shift # past value
;;
-d|--digital-twins-name)
digital_twin_name="$2"
shift # past argument
shift # past value
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $key"
usage
exit 1
esac
case $key in
-r|--resource-group-name)
resource_group="$2"
shift # past argument
shift # past value
;;
-l|--location)
location="$2"
shift # past argument
shift # past value
;;
-d|--digital-twins-name)
digital_twin_name="$2"
shift # past argument
shift # past value
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $key"
usage
exit 1
esac
done

# Check if all required arguments have been set
Expand All @@ -65,8 +65,8 @@ fi

# Assign the Digital Twins Data Owner role
echo -e "\nAssigning the Azure Digital Twins Data Owner role"
userObjectID=$(az ad signed-in-user show --query id -o tsv)
az dt role-assignment create --dt-name "$digital_twin_name" --assignee "$userObjectID" --role "Azure Digital Twins Data Owner"
user_object_id=$(az ad signed-in-user show --query id -o tsv)
az dt role-assignment create --dt-name "$digital_twin_name" --assignee "$user_object_id" --role "Azure Digital Twins Data Owner"

# Upload the sample-dtdl models
echo -e "\nUploading sample-dtdl models"
Expand Down
56 changes: 28 additions & 28 deletions cloud_connectors/azure/scripts/digital_twins_setup_smart_trailer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@ usage() {
# Parse command line arguments
while [[ $# -gt 0 ]]
do
key="$1"
key="$1"

case $key in
-r|--resource-group-name)
resource_group="$2"
shift # past argument
shift # past value
;;
-l|--location)
location="$2"
shift # past argument
shift # past value
;;
-d|--digital-twins-name)
digital_twin_name="$2"
shift # past argument
shift # past value
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $key"
usage
exit 1
esac
case $key in
-r|--resource-group-name)
resource_group="$2"
shift # past argument
shift # past value
;;
-l|--location)
location="$2"
shift # past argument
shift # past value
;;
-d|--digital-twins-name)
digital_twin_name="$2"
shift # past argument
shift # past value
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $key"
usage
exit 1
esac
done

# Check if all required arguments have been set
Expand All @@ -69,8 +69,8 @@ fi

# Assign the Digital Twins Data Owner role
echo -e "\nAssigning the Azure Digital Twins Data Owner role"
userObjectID=$(az ad signed-in-user show --query id -o tsv)
az dt role-assignment create --dt-name "$digital_twin_name" --assignee "$userObjectID" --role "Azure Digital Twins Data Owner"
user_object_id=$(az ad signed-in-user show --query id -o tsv)
az dt role-assignment create --dt-name "$digital_twin_name" --assignee "$user_object_id" --role "Azure Digital Twins Data Owner"

# Upload the sample-dtdl models
echo -e "\nUploading sample-dtdl models"
Expand Down

0 comments on commit f54165e

Please sign in to comment.