I am using an HTML form to take in parameters to use for Azure REST API calls.
My Code
@app.route('/storageaccountcreate', methods = ['POST', 'PUT'])
def storageaccountcreate():
name = request.form['storageaccountname']
resourcegroup = request.form['resourcegroup']
subscriptionId = request.form['subscriptionId']
location = request.form['location']
sku = request.form['sku']
keys = [name, resourcegroup, subscriptionId, location, sku]
api_json = {keys: request.form[key] for key in keys}
url = 'https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2019-06-01'
r = requests.put((url),data=(api_json))
print(r.text)
return r.text
I am getting the following error when trying to use this code
Bad Request
The browser (or proxy) sent a request that this server could not understand.
Also the debugging in VSC is showing the following
If you have any info that would help I would greatly appreciate it!
urlbe an f-string?{subscriptionId}to do in that string?api_json = {keys: request.form[key] for key in keys}subscriptionIdvariable there. or the key=value