Project Technology: Azure function, ADF, Azure Synapse, ADLS
Issue description: Customer has a strict regulatory compliance requirement, due to which they need to block all outbound (public endpoint) connections. Hence, most of our products were not able to provide the expected result as we have a dependency on public endpoints.
Summary:
Code if customer is using system assigned managed identity.
$resourceURI = "https://functeststorageacc01.queue.core.windows.net/"
$tokenAuthURI = $env:IDENTITY_ENDPOINT + "?resource=$resourceURI&api-version=2019-08-01"
$tokenResponse = Invoke-RestMethod -Method Get -Headers @{"X-IDENTITY-HEADER"="$env:IDENTITY_HEADER"} -Uri $tokenAuthURI
$accessToken = $tokenResponse.access_token
Code if customer is using user assigned managed identity.
$resourceURI = "https://functeststorageacc01.queue.core.windows.net/"
$tokenAuthURI = $env:IDENTITY_ENDPOINT + "?resource=$resourceURI&api-version=2019-08-01&client_id=$env:AZURE_CLIENT_ID"
$tokenResponse = Invoke-RestMethod -Method Get -Headers @{"X-IDENTITY-HEADER"="$env:IDENTITY_HEADER"} -Uri $tokenAuthURI
$accessToken = $tokenResponse.access_token
Code to use bearer token to access Azure storage.
$version = "2017-11-09"
$header = @{
Authorization = "Bearer $accessToken"
'x-ms-version' = $version
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$QueueMessage = "This is test message#1 "
$body = "<QueueMessage><MessageText>$QueueMessage</MessageText></QueueMessage>"
$item = Invoke-RestMethod -Method POST -Uri https://storazaarfdevbtgt00003.queue.core.windows.net/test2/messages -Headers $header -Body $body -ContentType "application/json"
9.After creating all the above steps we were able to trigger the ADF using Storage Event.
Co-Author: Umesh Panwar (Apps & Infra CSA)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.