-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest.sh
executable file
·13 lines (11 loc) · 3.52 KB
/
rest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash
set -x
subscription="c460cd3f-7c2a-48cc-9f5d-b62d6083ec23"
resource_group="cal-456-23"
provider="Microsoft.Sql"
api_version="2021-02-01-preview"
local_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJfS1hFZyIsImtpZCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJfS1hFZyJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9mZDFmYmY5Zi05OTFhLTQwYjQtYWUyNi02MWRmYzM0NDIxZWYvIiwiaWF0IjoxNjIxNjM2MzY3LCJuYmYiOjE2MjE2MzYzNjcsImV4cCI6MTYyMTY0MDI2NywiYWlvIjoiRTJaZ1lOQi91THN5MlBXbjYxdjlQUjFuSC9zRUFRQT0iLCJhcHBpZCI6IjE5MjNhZmU0LWIxNmMtNDAyMi1hNjU2LTk2MzljNDQ0YTFlMCIsImFwcGlkYWNyIjoiMSIsImdyb3VwcyI6WyI2ZDk1NjY0ZC0xYjc4LTQ2NGItYTViMC00OGYyOTExMzFjNmYiLCJkMzUzOTNjNy02NWRmLTQ0ZDctOTE2Ni1jMDVmYTdjYTRlNTciLCI5MjgzZWU3Yi0yYjU3LTRmNjItOWMxMS1kZTQwNWNhZjhjM2QiLCJmNWQ2ZDI4ZS00N2UyLTRmNmEtOTUzMi04NGZkYjQ1ZjUzYjUiLCJhZGQ2YjYzNS05YzEzLTQxMmEtOGQ0ZC1kMGZiYjk4MWZjODkiXSwiaWRwIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvZmQxZmJmOWYtOTkxYS00MGI0LWFlMjYtNjFkZmMzNDQy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Bamhuh1FxX1uOQk9BD26PUxO80PftiD8_Uc4Kw0sWKzKjhyifS7qWtI2gOnCPKsRfqK4ec-pHFBqpsQDu_x487ciz8bXYjkIe5pgi3ZoU1ijQiBU4P01pY3MUQRxau2ac5fKD6Y-vDKOPRPiA8EHTA"
use_local=0
token=$(if [ $use_local -eq 1 ]; then echo "local_token"; else echo "remote_token"; fi)
curl -XGET -H "Authorization: Bearer $(eval echo \$$token)" https://management.azure.com/subscriptions/$subscription/resourceGroups/$resource_group/providers/$provider/servers?api-version=$api_version