Skip to content

Commit ed071c7

Browse files
committed
Enhance AzCopy upload process: add logging for Managed Identity environment variables and AzCopy version for improved troubleshooting
1 parent 6e59f03 commit ed071c7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

function_app.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,27 @@ async def blob_to_dzi_eventgrid_trigger(event: func.EventGridEvent):
8989

9090
# Upload DZI files and all subdirectory files to the destination container using AzCopy with Managed Identity
9191
def upload_with_azcopy(local_dir):
92+
# Log MSI/Managed Identity environment variables for troubleshooting
93+
logger.info(f"IDENTITY_ENDPOINT: {os.environ.get('IDENTITY_ENDPOINT')}")
94+
logger.info(f"IDENTITY_HEADER: {os.environ.get('IDENTITY_HEADER')}")
95+
logger.info(f"IDENTITY_SERVER_THUMBPRINT: {os.environ.get('IDENTITY_SERVER_THUMBPRINT')}")
96+
logger.info(f"MSI_ENDPOINT: {os.environ.get('MSI_ENDPOINT')}")
97+
9298
dest_url = os.environ.get('DZI_UPLOAD_DEST_URL') # No SAS token!
9399
if not dest_url:
94100
logger.error('DZI_UPLOAD_DEST_URL environment variable not set!')
95101
return
96102
try:
103+
version_result = subprocess.run(["azcopy", "--version"], capture_output=True, text=True, check=True)
104+
logger.info(f"AzCopy version: {version_result.stdout.strip()}")
105+
97106
login_result = subprocess.run(["azcopy", "login", "--identity"], capture_output=True, text=True, check=True)
98107
logger.info(f"AzCopy login stdout: {login_result.stdout}")
99108
logger.info(f"AzCopy login stderr: {login_result.stderr}")
100109
except Exception as e:
101110
logger.error(f"AzCopy login with managed identity failed: {e}")
102111
return
112+
103113
cmd = [
104114
"azcopy", "copy",
105115
local_dir,

0 commit comments

Comments
 (0)