Share via

issue in 3 tier application

Zeeshan Ilyas 25 Reputation points
2026-05-27T20:29:56.85+00:00

Hi.

sir,

need ur assistance working on 3 tier project .i created a v-net

sarim-vnet under which 3 subnets fend-subnet , bend-subnet and db-subnet done , then i created 3 vms

fend-vm1 , bend-vm2 and db-vm all work using (gui) on azure portal done. then on fend-vm1 iis instaled on it and its simple frontpage open via pasting public ip on browser .

downloaded node js express on local machine and from local machine paste to fend-vm this pc : c node-v24.15.0-x64 now when i move to bend-vm2 in operations==> Run command ==> powershell it throws this error

Copy-Item "C:\node-v24.15.0-x64.msi" "Z:\nodejs.msi" bcoz when it find \n \node its move to next line whats the solution of it even , ping command works no issue in connectivity i use ping (pirvate-ip) it shows me result .plz gude me what to do.

hope u will help and guide .

even i try resolving the issue via terraform this is my terraform code main.tf but issue not resolved.

Removed PII

Azure Virtual Network
Azure Virtual Network

An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Zeeshan Ilyas 25 Reputation points
    2026-05-28T13:10:40.27+00:00

    Single quotes in PowerShell mean literal string but \n issue is happening inside Azure Run Command box not in PowerShell itself. like bend-vm2 ==> operations==> run command ===> run powershell script. hope u understand.

    1. if we give of internet to backend server/bend-vm2 the purpose of whloe lab deminish bcoz .we secure bend. and cant give access to backend. front-end ===> backend===> data-base. (frm internet while using public ip rdp +http we landed home page) data-base===> backend===> front-end ===> (we access bend , and from bend while using private ip access db)

    Was this answer helpful?

    0 comments No comments

  2. Alex Burlachenko 22,120 Reputation points MVP Volunteer Moderator
    2026-05-28T11:00:31.3433333+00:00

    hi Zeeshan Ilyas & thanks for join me here at Q&A portal,

    the issue is not Terraform and not \n. The problem is that Run Command executes locally on bend-vm2, but your MSI file exists on fend-vm1.

    Copy-Item "C:\node-v24.15.0-x64.msi" "Z:\nodejs.msi"

    tries to find the MSI on the backend VM itself, not on the frontend VM.

    do not copy the installer between VMs at all. Just download Node.js directly on bend-vm2

    Invoke-WebRequest `

    -Uri "https://nodejs.org/dist/v24.15.0/node-v24.15.0-x64.msi" `

    -OutFile "C:\nodejs.msi"

    Start-Process msiexec.exe `

    -Wait `

    -ArgumentList '/I C:\nodejs.msi /quiet'

    Your Terraform custom_data already does this correctly, so manual copying is unnecessary. If you really want to copy between VMs, you need SMB sharing

    Copy-Item "\192.14.0.X\share\node.msi" "C:\nodejs.msi"

    not Z: and not local C: paths.

    Ur VNet range 192.14.x.x is not a private RFC1918 range. Use something like

    10.0.0.0/24

    172.16.0.0/16

    192.168.0.0/16

    https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/private-ip-addresses

    just let the backend VM download Node.js directly. Much cleaner and easier.

    rgds,

    Alex

    &

    If my answer was helpful pls mark it and additional thx if u follow me at Q&A portal
    

    Was this answer helpful?


  3. Jerald Felix 13,500 Reputation points Volunteer Moderator
    2026-05-28T07:27:59.3566667+00:00

    Hello Zeeshan Ilyas

    Greetings! Thanks for raising this question in Q&A forum.

    Great work setting up a 3-tier architecture on Azure! The issue you're facing is actually a very common and simple PowerShell problem it has nothing to do with your network or VM connectivity. The \n inside your path C:\node-v24.15.0-x64.msi is being interpreted by PowerShell as a newline escape character instead of a backslash. So when PowerShell sees \n, it thinks you're starting a new line and breaks your path, causing the Copy-Item command to fail.

    Here's how to fix it step by step:

    Step 1: Use a single-quoted string in PowerShell to avoid escape interpretation When you run the command in Run Command, wrap your path in single quotes like this:

    Copy-Item 'C:\node-v24.15.0-x64.msi' 'Z:\nodejs.msi'
    

    Single quotes in PowerShell treat everything literally and do not interpret \n, \t, or any other escape sequences.

    Step 2: Or use double backslashes as an alternative If you prefer double quotes, escape the backslash by doubling it:

    Copy-Item "C:\\node-v24.15.0-x64.msi" "Z:\\nodejs.msi"
    

    Step 3: Skip the Copy-Item approach entirely — use a better method Instead of copying the Node.js installer from fend-vm1 to bend-vm2 using a network share, I strongly recommend you download Node.js directly inside bend-vm2. This is cleaner, simpler, and avoids the network share (Z: drive) mapping issue altogether.

    In bend-vm2's Run Command (PowerShell), run this:

    Invoke-WebRequest -Uri "https://nodejs.org/dist/v20.11.0/node-v20.11.0-x64.msi" -OutFile "C:\nodejs.msi"
    Start-Process msiexec.exe -Wait -ArgumentList '/I C:\nodejs.msi /quiet'
    

    This downloads Node.js straight from the internet into bend-vm2 and installs it silently — no file copying across VMs needed.

    Step 4: Make sure bend-vm2 has outbound internet access Since bend-vm2 has no public IP, it needs outbound internet access to download Node.js. By default, Azure VMs in a VNet can reach the internet outbound even without a public IP. You can confirm this by running the following in bend-vm2's Run Command:

    Test-NetConnection -ComputerName nodejs.org -Port 443
    

    If it shows TcpTestSucceeded: True, you're good to go.

    Step 5: Regarding your Terraform code — it looks great overall! Your custom_data block in the Terraform for bend-vm2 already handles Node.js installation correctly by downloading directly from the internet. The issue is only in the manual Copy-Item command you tried in the portal's Run Command — that is what has the \n problem. Your Terraform approach is actually the right way to go and should work as written.

    One small thing to note in your Terraform — custom_data on Windows VMs requires the content to be valid <powershell> script wrapped correctly in the CloudInit format, which your code already does. Just make sure the VM is fully provisioned and the custom_data script has completed before you try to test the Node.js endpoint on port 3000.

    Step 6: Test the backend is running after Node.js is installed Once Node.js and your Express server are running on bend-vm2, test it from fend-vm1 using:

    Invoke-WebRequest -Uri "http://<bend-vm2-private-ip>:3000" -UseBasicParsing
    

    If you get back the "Hello from Backend VM2" message, everything is working correctly end to end.

    If this answer helps you kindly accept the answer which will help others who have similar questions.

    Best Regards,

    Jerald Felix.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.