-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The terraform output from a provisioned API-mgmt service returns an scm_url with no credentials. #3002
Comments
hey @NathanielRose Thanks for splitting this out into it's own issue :) Out of interest, would it be possible to provide an example of the script you're using to obtain these credentials? I'm assuming this calls either the Tenant Access API or the Tenant Access Git API - but it'd be good to confirm which so that we could look to add support for this. Thanks! |
Hey @tombuildsstuff , It was a bit confusing at first on how to obtain the credentials which turns out does not involved the #!/bin/sh
while getopts :b:f:g:k:d: option
do
case "${option}" in
b) subscription_id=${OPTARG};;
f) rg_name=${OPTARG};;
g) service_name=${OPTARG};;
k) api_config_repo=${OPTARG};;
d) authorization_bearer=${OPTARG};;
esac
done
urlencode() {
python -c 'import urllib, sys; print urllib.quote(sys.argv[1], sys.argv[2])' \
"$1" "$urlencode_safe"
}
expire_time=$(date -d "+1 days" +%FT%TZ)
response_out=$(curl -X \
POST -d '{"api-version":"2018-06-01-preview", "keyType":"primary", "expiry": "'"$expiry_time"'"}' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer "'"$bearer_token"'" \
https://management.azure.com/subscriptions/${subscription_id}/resourceGroups/${rg_name}/providers/Microsoft.ApiManagement/service/${service_name}/tenant/configuration/git?api-version=2018-06-01-preview&keyType=primary&expiry=$expire_time)
token=$(urlencode $(echo $response_out | jq '.value' --raw-output))
git clone https://apim:$token@$service_name.scm.azure-api.net
|
Hey @tombuildsstuff , We have built an improved script for API Management with terraform deployment here https://github.com/Microsoft/bedrock/tree/api-mgmt/cluster/environments/azure-api-mgmt Any updates on a new version of the API Management provider? |
Since this issue has been reported a long time ago and relates to the version of provider we no longer support - I'm going to close it. Please open a new updated bug report if this is still relevant. Thank you. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Description
The terraform output from a provisioned API-mgmt service returns an scm_url with no credentials. This requires us to run a separate script to generate the tokens for us to push to the repo.
New or Affected Resource(s)
Potential Terraform Configuration
It would be better to have the url pass some sore of tokens or credentials for a user to begin cloning the API management service repo. Once keys are generated you then have to deploy your commit to the API-mgmt service through the rest api adding another step in an automated script.
References
The text was updated successfully, but these errors were encountered: