Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/azure-cli/azure/cli/command_modules/resource/_bicep.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import platform
import subprocess
import json
import certifi

from json.decoder import JSONDecodeError
from contextlib import suppress
Expand Down Expand Up @@ -106,8 +107,8 @@ def ensure_bicep_installation(release_tag=None, stdout=True):
print(f"Installing Bicep CLI {release_tag}...")
else:
print("Installing Bicep CLI...")

request = urlopen(_get_bicep_download_url(system, release_tag))
ca_file = certifi.where()
request = urlopen(_get_bicep_download_url(system, release_tag), cafile=ca_file)
with open(installation_path, "wb") as f:
f.write(request.read())

Expand Down Expand Up @@ -140,15 +141,17 @@ def is_bicep_file(file_path):

def get_bicep_available_release_tags():
try:
response = requests.get("https://aka.ms/BicepReleases")
ca_file = certifi.where()
response = requests.get("https://aka.ms/BicepReleases", verify=ca_file)
Comment on lines +144 to +145

@jiasli jiasli Mar 31, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This make requests only use certifi.where(). Env var REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE no longer take effect.

return [release["tag_name"] for release in response.json()]
except IOError as err:
raise ClientRequestError(f"Error while attempting to retrieve available Bicep versions: {err}.")


def get_bicep_latest_release_tag():
try:
response = requests.get("https://aka.ms/BicepLatestRelease")
ca_file = certifi.where()
response = requests.get("https://aka.ms/BicepLatestRelease", verify=ca_file)
response.raise_for_status()
return response.json()["tag_name"]
except IOError as err:
Expand Down