question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to create private endpoints in CLI using bash terminal

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az network private-endpoint create

Errors:

request failed: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/b526aa26-e5c4-4583-90a3-6d0a4663242a/resourceGroups/rg-eu2-network/providers/Microsoft.Network/privateEndpoints/pe-eu2-iris-dev-006?api-version=2020-03-01 (Caused by ResponseError('too many 500 error responses',))

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here…
  • az network private-endpoint create --name {} --resource-group {} --vnet-name {} --subnet {} --location {} --private-connection-resource-id {} --group-id {} --connection-name {} --tags {}

Expected Behavior

Environment Summary

Windows-10-10.0.17763-SP0
Python 3.6.6
Installer: 

azure-cli 2.6.0

Extensions:
interactive 0.4.4

Additional Context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
zhoxing-mscommented, Jun 28, 2020

I have reproduced this problem in the WSL environment and identified the root cause: The newline character in WSL is LF and the newline character in windows is CRLF. Therefore, when a script written under Windows is used in WSL, only \n in the newline character \r\n of CRLF is recognized as the newline character of LF, while \r is recognized as plain text.

For example:

  1. Write a bash script in Windows, which is in CRLF format: The script content:
group_name=$(az group show -n zhoxing-test --query name)
echo $group_name
az group create -l westus --debug -n $group_name
  1. Execute the script in the WSL environment
root@DESKTOP-S8GCCTE:/mnt/c/Users/zhoxing.FAREAST/Desktop# file test.sh
test.sh: ASCII text, with CRLF line terminators

root@DESKTOP-S8GCCTE:/mnt/c/Users/zhoxing.FAREAST/Desktop# bash test.sh
"zhoxing-test"
Command arguments: ['group', 'create', '-l', 'westus', '--debug', '-n', '"zhoxing-test"\r\r']

At this point, the value of group_name is added with \r due to incompatibility between WSL and windows newline character.

  1. Convert the file format from CRLF to LF and then execute the script
root@DESKTOP-S8GCCTE:/mnt/c/Users/zhoxing.FAREAST/Desktop# dos2unix test.sh
dos2unix: converting file test.sh to Unix format...

root@DESKTOP-S8GCCTE:/mnt/c/Users/zhoxing.FAREAST/Desktop# file test.sh
test.sh: ASCII text

root@DESKTOP-S8GCCTE:/mnt/c/Users/zhoxing.FAREAST/Desktop# bash test.sh
"zhoxing-test"
Command arguments: ['group', 'create', '-l', 'westus', '--debug', '-n', '"zhoxing-test"']

Problem solving after the file format becomes LF.

@lchave The same is true even if the value of the variable is not written directly in the file but is returned from a query (as the example I provided). So when using CRLF files in Unix and Unix-like Systems (including WSL), you need to convert the file to LF (you can use the command dos2unix)

For more information, please refer to: click

0reactions
zhoxing-mscommented, Jul 8, 2020

Because there is no reply to this question for a long time, I will close it temporarily. If you have any questions, please feel free to let us know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quickstart: Create a Private Link service using Azure CLI
In this quickstart, learn how to create an Azure Private Link service using Azure CLI.
Read more >
create-vpc-endpoint — AWS CLI 1.27.35 Command Reference
Creates a VPC endpoint for a specified service. An endpoint enables you to create a private connection between your VPC and the service....
Read more >
Installing and using private endpoints - IBM Cloud Docs
To install the latest CLI for your OS from the shell manually, use the following command for your OS: If you don't want...
Read more >
delete — OCI CLI Command Reference 3.21.0 documentation
Usage¶. oci resource-manager private-endpoint delete [OPTIONS] ... option can be used to generate a sample json file to be used with this command...
Read more >
Set Up a Private Endpoint — MongoDB Atlas
Connections to Atlas database deployments using private endpoints offer the ... setting for your project using the Atlas CLI, run the following command: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found