You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-16Lines changed: 26 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -15,20 +15,19 @@ For information on moving data from Azure Files SMB shares to AWS using AWS Data
15
15
16
16
To start the deployment, make sure you have met all the necessary prerequisites and are familiar with the configuration parameters needed for successful execution.
17
17
18
-
It's recommended to log in to your Azure account before running the script. During the script execution, you'll be prompted to enter the authorization code provided in the Azure console to grant the script access to your Azure resources.
18
+
**It is recommended to log in to your Azure account before running the script.** During the script execution, you'll be prompted to enter the authorization code provided in the Azure console to grant the script access to your Azure resources.
19
19
20
20
## Deployment Steps
21
21
22
-
The deployment script automates several steps to ensure a smooth integration between AWS DataSync and Azure services. Here's a breakdown of the deployment process:
22
+
The deployment script automates the following steps to integrate AWS DataSync with Azure:
23
23
24
-
1. Provide Configuration Parameters: Before executing the script, open it in your preferred editor and provide the necessary configuration parameters. These parameters will be used to customize the deployment according to your requirements.
25
-
2. Install Azure CLI and AzCopy: As a part of the setup process, the script will **automatically** download and install the Azure Command-Line Interface (CLI) and AzCopy tools. These tools are essential for managing and transferring data within the Azure environment.
26
-
3. Download AWS DataSync Agent for Hyper-V: The script will download the AWS DataSync Agent specifically designed for Hyper-V environment.
27
-
4. Convert VHDX to VHD: Once the AWS DataSync Agent is downloaded, the script will take care of converting the Virtual Hard Disk (VHDX) file to the compatible Hyper-V Disk (HVD) format for Azure
28
-
5. Azure Authentication: To access and manage your Azure resources, the script will guide you through the authentication process, ensuring secure access to your Azure account.
29
-
6. Create Resource Group: The deployment script will automatically create or use an existing Azure Resource Group. This Resource Group will serve as the container for your deployed resources.
30
-
7. Upload VHD as Managed Disk: The script will upload the converted VHD file as a managed disk within the specified Resource Group. This disk will contain the AWS DataSync Agent.
31
-
8. Create Virtual Machine: Leveraging the uploaded managed disk, the script will create an Azure Virtual Machine in either a new VNET or an existing VNET and subnet.
24
+
1.**Provide Configuration Parameters**: Customize the deployment by specifying required parameters such as deployment type, location, resource group, and VM details.
25
+
2.**Install Dependencies**: Automatically installs Azure CLI, AzCopy, and other required tools.
26
+
3.**Download and Convert DataSync Agent**: Downloads the AWS DataSync agent and converts it to a VHD format compatible with Azure.
27
+
4.**Authenticate with Azure**: Guides you through logging into Azure to manage resources securely and validates the provided Subscription ID (if specified).
28
+
5.**Create or Use Resource Group**: Ensures the specified Azure resource group exists or creates it if necessary.
29
+
6.**Upload VHD to Azure**: Renames the VHD file to match the Azure VM name and uploads it as a managed disk in Azure.
30
+
7.**Create Azure VM**: Deploys an Azure Virtual Machine using the uploaded VHD, supporting both new and existing VNET configurations.
32
31
33
32
### Prerequisites
34
33
@@ -51,6 +50,9 @@ Before running the deployment script, please ensure that you have the following
51
50
-**Virtual Machine Name (-v)**: The name for the Azure Virtual Machine that will host the AWS DataSync Agent (e.g. aws-datasync-vm)
52
51
-**Virtual Machine Size (-z)**: Azure VM size (e.g., 'Standard_E4s_v3', 'Standard_E16_v5')
53
52
53
+
**Optional Parameter:**
54
+
-**Subscription ID (-u)**: Azure subscription ID (optional)
55
+
54
56
**Additional Parameters (when -d is existing_vnet):**
55
57
-**VNET Resource Group (-g)**: Virtual network resource group (required for 'existing_vnet')
56
58
-**VNET Name (-n)**: Virtual network name (required for 'existing_vnet')
@@ -70,9 +72,6 @@ When selecting the Azure Virtual Machine for the Datasync Agent, we recommend th
70
72
- For detailed AWS DataSync agent requirements, see the [AWS DataSync Agent Requirements](https://docs.aws.amazon.com/datasync/latest/userguide/agent-requirements.html) documentation.
71
73
72
74
---
73
-
74
-
### Download the Deployment Script
75
-
76
75
Run the following command to download the deployment script from the code repository:
77
76
78
77
```
@@ -86,15 +85,26 @@ chmod +x datasync.sh
86
85
87
86
Once you have your parameters ready, you can initiate the deployment script using the following commands:
Replace `subscription-id` with your actual Azure subscription ID.
99
+
100
+
### Subscription ID Validation
101
+
102
+
The script validates the provided Azure subscription ID to ensure it is correct. If the subscription ID is invalid, the script will log an error and exit. Retrieve the correct subscription ID using the following command in Azure CloudShell:
103
+
104
+
```
105
+
az account list --output table
106
+
```
107
+
### Download the Deployment Script
98
108
99
109
## Azure CLI Login
100
110
You will be prompted to login to Azure and allow the script to create the Virtual Machine for the DataSync Appliance
az account show --subscription "$subscription_id"> /dev/null 2>&1|| {
194
+
log_error "Please ensure you entered the correct Azure subscription ID. You can run the command \"az account list --output table\" from Azure CloudShell to provide the subscription ID."
195
+
exit 1
196
+
}
197
+
log_success "Azure subscription ID is valid: $subscription_id"
198
+
az account set --subscription "$subscription_id"|| {
199
+
log_error "Please ensure you entered the correct Azure subscription ID. You can run the command \"az account list --output table\" from Azure CloudShell to provide the subscription ID."
200
+
exit 1
201
+
}
202
+
fi
203
+
182
204
check_resource_group
183
205
184
206
az disk create -n "$disk_name" -g "$resource_group" -l "$location" --os-type Linux --upload-type Upload --upload-size-bytes "$upload_size" --sku Standard_LRS --only-show-errors || {
185
-
log_error "Failed to create Azure disk."
207
+
log_error "Failed to create Azure disk. Ensure the disk is created with the correct upload type."
186
208
exit 1
187
209
}
188
210
211
+
# Verify the disk state before granting SAS access
212
+
disk_state=$(az disk show -n "$disk_name" -g "$resource_group" --query 'diskState' -o tsv)
213
+
if [[ "$disk_state"!="ReadyToUpload"&&"$disk_state"!="ActiveUpload" ]];then
214
+
log_error "Disk is not in a valid state for upload. Current state: $disk_state"
0 commit comments