|
| 1 | +--- |
| 2 | +title: Configure storage for Azure Application Consistent Snapshot tool for Azure NetApp Files |
| 3 | +description: Learn how to configure storage for use with the Azure Application Consistent Snapshot tool that you can use with Azure NetApp Files. |
| 4 | +services: azure-netapp-files |
| 5 | +author: Phil-Jensen |
| 6 | +ms.service: azure-netapp-files |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 05/15/2024 |
| 9 | +ms.author: phjensen |
| 10 | +--- |
| 11 | + |
| 12 | +# Configure storage for Azure Application Consistent Snapshot tool |
| 13 | + |
| 14 | +This article provides a guide for configuring the Azure storage to be used with the Azure Application Consistent Snapshot tool (AzAcSnap). |
| 15 | + |
| 16 | +Select the storage you're using with AzAcSnap. |
| 17 | + |
| 18 | +# [Azure NetApp Files](#tab/azure-netapp-files) |
| 19 | + |
| 20 | +Either set up a system-managed identity (resommended) or generate the service principal's authentication file. |
| 21 | + |
| 22 | +When you're validating communication with Azure NetApp Files, communication might fail or time out. Check that firewall rules aren't blocking outbound traffic from the system running AzAcSnap to the following addresses and TCP/IP ports: |
| 23 | + |
| 24 | + - (https://)management.azure.com:443 |
| 25 | + - (https://)login.microsoftonline.com:443 |
| 26 | + |
| 27 | +# [Azure Large Instances (bare metal)](#tab/azure-large-instance) |
| 28 | + |
| 29 | +You'll need to generate your own self-signed certificate and then share the contents of the PEM (Privacy Enhanced Mail) file with Microsoft Operations so it can be installed to the Storage back-end to allow AzAcSnap to securely authenticate with ONTAP. |
| 30 | + |
| 31 | +Combine the PEM and KEY into a single PKCS12 file which is needed by AzAcSnap for certificate-based authentication to ONTAP. |
| 32 | + |
| 33 | +Test the PKCS12 file by using `curl` to connect to one of the nodes. |
| 34 | + |
| 35 | +> Microsoft Operations provides the storage username and storage IP address at the time of provisioning. |
| 36 | +
|
| 37 | +--- |
| 38 | + |
| 39 | +## Enable communication with storage |
| 40 | + |
| 41 | +This section explains how to enable communication with storage. Use the following tabs to correctly select the storage back end that you're using. |
| 42 | + |
| 43 | +# [Azure NetApp Files (with virtual machine)](#tab/azure-netapp-files) |
| 44 | + |
| 45 | +There are two ways to authenticate to the Azure Resource Manager using either a system-managed identity or a service principal file. The options are described here. |
| 46 | + |
| 47 | +### Azure system-managed identity |
| 48 | + |
| 49 | +From AzAcSnap 9, it's possible to use a system-managed identity instead of a service principal for operation. Using this feature avoids the need to store service principal credentials on a virtual machine (VM). To set up an Azure managed identity by using Azure Cloud Shell, follow these steps: |
| 50 | + |
| 51 | +1. Within a Cloud Shell session with Bash, use the following example to set the shell variables appropriately and apply them to the subscription where you want to create the Azure managed identity. Set `SUBSCRIPTION`, `VM_NAME`, and `RESOURCE_GROUP` to your site-specific values. |
| 52 | + |
| 53 | + ```azurecli-interactive |
| 54 | + export SUBSCRIPTION="99z999zz-99z9-99zz-99zz-9z9zz999zz99" |
| 55 | + export VM_NAME="MyVM" |
| 56 | + export RESOURCE_GROUP="MyResourceGroup" |
| 57 | + export ROLE="Contributor" |
| 58 | + export SCOPE="/subscriptions/${SUBSCRIPTION}/resourceGroups/${RESOURCE_GROUP}" |
| 59 | + ``` |
| 60 | + |
| 61 | +1. Set Cloud Shell to the correct subscription: |
| 62 | + |
| 63 | + ```azurecli-interactive |
| 64 | + az account set -s "${SUBSCRIPTION}" |
| 65 | + ``` |
| 66 | + |
| 67 | +1. Create the managed identity for the virtual machine. The following command sets (or shows if it's already set) the AzAcSnap VM's managed identity: |
| 68 | + |
| 69 | + ```azurecli-interactive |
| 70 | + az vm identity assign --name "${VM_NAME}" --resource-group "${RESOURCE_GROUP}" |
| 71 | + ``` |
| 72 | + |
| 73 | +1. Get the principal ID for assigning a role: |
| 74 | + |
| 75 | + ```azurecli-interactive |
| 76 | + PRINCIPAL_ID=$(az resource list -n ${VM_NAME} --query [*].identity.principalId --out tsv) |
| 77 | + ``` |
| 78 | + |
| 79 | +1. Assign the Contributor role to the principal ID: |
| 80 | + |
| 81 | + ```azurecli-interactive |
| 82 | + az role assignment create --assignee "${PRINCIPAL_ID}" --role "${ROLE}" --scope "${SCOPE}" |
| 83 | + ``` |
| 84 | + |
| 85 | +#### Optional RBAC |
| 86 | + |
| 87 | +It's possible to limit the permissions for the managed identity by using a custom role definition in role-based access control (RBAC). Create a suitable role definition for the virtual machine to be able to manage snapshots. You can find example permissions settings in [Tips and tricks for using the Azure Application Consistent Snapshot tool](azacsnap-tips.md). |
| 88 | + |
| 89 | +Then assign the role to the Azure VM principal ID (also displayed as `SystemAssignedIdentity`): |
| 90 | + |
| 91 | +```azurecli-interactive |
| 92 | +az role assignment create --assignee ${PRINCIPAL_ID} --role "AzAcSnap on ANF" --scope "${SCOPE}" |
| 93 | +``` |
| 94 | + |
| 95 | +### Generate a service principal file |
| 96 | + |
| 97 | +1. In a Cloud Shell session, make sure you're logged on at the subscription where you want to be associated with the service principal by default: |
| 98 | + |
| 99 | + ```azurecli-interactive |
| 100 | + az account show |
| 101 | + ``` |
| 102 | +
|
| 103 | +1. If the subscription isn't correct, use the `az account set` command: |
| 104 | +
|
| 105 | + ```azurecli-interactive |
| 106 | + az account set -s <subscription name or id> |
| 107 | + ``` |
| 108 | +
|
| 109 | +1. Create a service principal by using the Azure CLI, as shown in this example: |
| 110 | +
|
| 111 | + ```azurecli-interactive |
| 112 | + az ad sp create-for-rbac --name "AzAcSnap" --role Contributor --scopes /subscriptions/{subscription-id} --sdk-auth |
| 113 | + ``` |
| 114 | +
|
| 115 | + The command should generate output like this example: |
| 116 | +
|
| 117 | + ```output |
| 118 | + { |
| 119 | + "clientId": "00aa000a-aaaa-0000-00a0-00aa000aaa0a", |
| 120 | + "clientSecret": "00aa000a-aaaa-0000-00a0-00aa000aaa0a", |
| 121 | + "subscriptionId": "00aa000a-aaaa-0000-00a0-00aa000aaa0a", |
| 122 | + "tenantId": "00aa000a-aaaa-0000-00a0-00aa000aaa0a", |
| 123 | + "activeDirectoryEndpointUrl": "https://login.microsoftonline.com", |
| 124 | + "resourceManagerEndpointUrl": "https://management.azure.com/", |
| 125 | + "activeDirectoryGraphResourceId": "https://graph.windows.net/", |
| 126 | + "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/", |
| 127 | + "galleryEndpointUrl": "https://gallery.azure.com/", |
| 128 | + "managementEndpointUrl": "https://management.core.windows.net/" |
| 129 | + } |
| 130 | + ``` |
| 131 | +
|
| 132 | + This command automatically assigns the RBAC Contributor role to the service principal at the subscription level. You can narrow down the scope to the specific resource group where your tests will create the resources. |
| 133 | +
|
| 134 | +1. Cut and paste the output content into a file called `azureauth.json` that's stored on the same system as the `azacsnap` command. Secure the file with appropriate system permissions. |
| 135 | +
|
| 136 | + Make sure the format of the JSON file is exactly as described in the previous step, with the URLs enclosed in double quotation marks ("). |
| 137 | +
|
| 138 | +# [Azure Large Instances (bare metal)](#tab/azure-large-instance) |
| 139 | +
|
| 140 | +> [!IMPORTANT] |
| 141 | +> From AzAcSnap 10, communicatoin with Azure Large Instance storage is using the REST API over HTTPS. Versions prior to AzAcSnap 10 use the CLI over SSH. |
| 142 | +
|
| 143 | +### Azure Large Instance REST API over HTTPS |
| 144 | +
|
| 145 | +Communication with the storage back end occurs over an encrypted HTTPS channel using certificate-based authentication. The following example steps provide guidance on setup of the PKCS12 certificate for this communication: |
| 146 | +
|
| 147 | +1. Generate the PEM and KEY files. |
| 148 | +
|
| 149 | + > The CN equals the SVM username, ask Microsoft Operations for this SVM username. |
| 150 | +
|
| 151 | + In this example we are using `svmadmin01` as our SVM username, modify this as necessary for your installation. |
| 152 | + |
| 153 | + ```bash |
| 154 | + openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -keyout svmadmin01.key -out svmadmin01.pem -subj "/C=US/ST=WA/L=Redmond/O=MSFT/CN=svmadmin01" |
| 155 | + ``` |
| 156 | + |
| 157 | + Refer to the following output: |
| 158 | +
|
| 159 | + ```output |
| 160 | + Generating a RSA private key |
| 161 | + ........................................................................................................+++++ |
| 162 | + ....................................+++++ |
| 163 | + writing new private key to 'svmadmin01.key' |
| 164 | + ----- |
| 165 | + ``` |
| 166 | +
|
| 167 | +1. Output the contents of the PEM file. |
| 168 | +
|
| 169 | + The contents of the PEM file are used for adding the client-ca to the SVM. |
| 170 | +
|
| 171 | + > ! Send the contents of the PEM file to the Microsoft BareMetal Infrastructure (BMI) administrator. |
| 172 | +
|
| 173 | +
|
| 174 | + ```bash |
| 175 | + cat svmadmin01.pem |
| 176 | + ``` |
| 177 | + |
| 178 | + ```output |
| 179 | + -----BEGIN CERTIFICATE----- |
| 180 | + MIIDgTCCAmmgAwIBAgIUGlEfGBAwSzSFx8s19lsdn9EcXWcwDQYJKoZIhvcNAQEL |
| 181 | + /zANBgkqhkiG9w0BAQsFAAOCAQEAFkbKiQ3AF1kaiOpl8lt0SGuTwKRBzo55pwqf |
| 182 | + PmLUFF2sWuG5Yaw4sGPGPgDrkIvU6jcyHpFVsl6e1tUcECZh6lcK0MwFfQZjHwfs |
| 183 | + MRAwDgYDVQQHDAdSZWRtb25kMQ0wCwYDVQQKDARNU0ZUMRMwEQYDVQQDDApzdm1h |
| 184 | + ZG1pbjAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuE6H2/DK9xjz |
| 185 | + TY1JSYIeArJ3GQnBz7Fw2KBT+Z9dl2kO8p3hjSE/5W1vY+5NLDjEH6HG1xH12QUO |
| 186 | + y2+NoT2s4KhGgWbHuJHpQqLsNFqaOuLyc3ofK7BPz/9JHz5JKmNu1Fn9Ql8s4FRQ |
| 187 | + 4GzXDf4qC+JhQBO3iSvXuwDRfGs9Ja2x1r8yOJEHxmnLgGVw6Q== |
| 188 | + -----END CERTIFICATE----- |
| 189 | + ``` |
| 190 | + |
| 191 | +1. Combine the PEM and KEY into a single PKCS12 file (needed for AzAcSnap). |
| 192 | + |
| 193 | + ```bash |
| 194 | + openssl pkcs12 -export -out svmadmin01.p12 -inkey svmadmin01.key -in svmadmin01.pem |
| 195 | + ``` |
| 196 | + |
| 197 | + > The file svmadmin01.p12 is used as the value for certificateFile in the aliStorageResource section of the AzAcSnap configuration file. |
| 198 | + |
| 199 | +1. Test the PKCS12 file using curl. |
| 200 | + |
| 201 | + After getting confirmation from Microsoft Operations they have applied the certificate to the SVM to allow certificate-based login, then test connectivity to the SVM. |
| 202 | + |
| 203 | + In this example we are using the PKCS12 file called svmadmin01.p12 to connect to the SVM host "X.X.X.X" (this IP address will be provided by Microsoft Operations). |
| 204 | + |
| 205 | + ```bash |
| 206 | + curl --cert-type P12 --cert svmadmin01.p12 -k 'https://X.X.X.X/api/cluster?fields=version' |
| 207 | + ``` |
| 208 | + |
| 209 | + ```output |
| 210 | + { |
| 211 | + "version": { |
| 212 | + "full": "NetApp Release 9.15.1: Wed Feb 21 05:56:27 UTC 2024", |
| 213 | + "generation": 9, |
| 214 | + "major": 15, |
| 215 | + "minor": 1 |
| 216 | + }, |
| 217 | + "_links": { |
| 218 | + "self": { |
| 219 | + "href": "/api/cluster" |
| 220 | + } |
| 221 | + } |
| 222 | + } |
| 223 | + ``` |
| 224 | + |
| 225 | +### Azure Large Instance CLI over SSH |
| 226 | + |
| 227 | +> [!WARNING] |
| 228 | +> These instructions are for versions prior to AzAcSnap 10 and we are no longer updating this section of the content regularly. |
| 229 | + |
| 230 | +Communication with the storage back end occurs over an encrypted SSH channel. The following example steps provide guidance on setup of SSH for this communication: |
| 231 | + |
| 232 | +1. Modify the `/etc/ssh/ssh_config` file. |
| 233 | + |
| 234 | + Refer to the following output, which includes the `MACs hmac-sha` line: |
| 235 | + |
| 236 | + ```output |
| 237 | + # RhostsRSAAuthentication no |
| 238 | + # RSAAuthentication yes |
| 239 | + # PasswordAuthentication yes |
| 240 | + # HostbasedAuthentication no |
| 241 | + # GSSAPIAuthentication no |
| 242 | + # GSSAPIDelegateCredentials no |
| 243 | + # GSSAPIKeyExchange no |
| 244 | + # GSSAPITrustDNS no |
| 245 | + # BatchMode no |
| 246 | + # CheckHostIP yes |
| 247 | + # AddressFamily any |
| 248 | + # ConnectTimeout 0 |
| 249 | + # StrictHostKeyChecking ask |
| 250 | + # IdentityFile ~/.ssh/identity |
| 251 | + # IdentityFile ~/.ssh/id_rsa |
| 252 | + # IdentityFile ~/.ssh/id_dsa |
| 253 | + # Port 22 |
| 254 | + Protocol 2 |
| 255 | + # Cipher 3des |
| 256 | + # Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des- |
| 257 | + cbc |
| 258 | + # MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd |
| 259 | + MACs hmac-sha |
| 260 | + # EscapeChar ~ |
| 261 | + # Tunnel no |
| 262 | + # TunnelDevice any:any |
| 263 | + # PermitLocalCommand no |
| 264 | + # VisualHostKey no |
| 265 | + # ProxyCommand ssh -q -W %h:%p gateway.example.com |
| 266 | + ``` |
| 267 | + |
| 268 | +1. Use the following example command to generate a private/public key pair. Don't enter a password when you're generating a key. |
| 269 | + |
| 270 | + ```bash |
| 271 | + ssh-keygen -t rsa –b 5120 -C "" |
| 272 | + ``` |
| 273 | + |
| 274 | +1. The output of the `cat /root/.ssh/id_rsa.pub` command is the public key. Send it to Microsoft Operations, so that the snapshot tools can communicate with the storage subsystem. |
| 275 | + |
| 276 | + ```bash |
| 277 | + cat /root/.ssh/id_rsa.pub |
| 278 | + ``` |
| 279 | + |
| 280 | + ```output |
| 281 | + ssh-rsa |
| 282 | + AAAAB3NzaC1yc2EAAAADAQABAAABAQDoaRCgwn1Ll31NyDZy0UsOCKcc9nu2qdAPHdCzleiTWISvPW |
| 283 | + FzIFxz8iOaxpeTshH7GRonGs9HNtRkkz6mpK7pCGNJdxS4wJC9MZdXNt+JhuT23NajrTEnt1jXiVFH |
| 284 | + bh3jD7LjJGMb4GNvqeiBExyBDA2pXdlednOaE4dtiZ1N03Bc/J4TNuNhhQbdsIWZsqKt9OPUuTfD |
| 285 | + j0XvwUTLQbR4peGNfN1/cefcLxDlAgI+TmKdfgnLXIsSfbacXoTbqyBRwCi7p+bJnJD07zSc9YCZJa |
| 286 | + wKGAIilSg7s6Bq/2lAPDN1TqwIF8wQhAg2C7yeZHyE/ckaw/eQYuJtN+RNBD |
| 287 | + ``` |
| 288 | + |
| 289 | + |
| 290 | + |
| 291 | +--- |
| 292 | + |
| 293 | + |
| 294 | +## Next steps |
| 295 | + |
| 296 | +- [Configure Azure Application Consistent Snapshot tool](azacsnap-cmd-ref-configure.md) |
0 commit comments