I called below AZURE API from postman.
https://management.azure.com/subscriptions/{SubscriptionID}/providers/Microsoft.Commerce/UsageAggregates?api-version=2015-06-01-preview&reportedstartTime=2019-12-29T00%3a00%3a00%2b00%3a00&reportedEndTime=2019-12-30T00%3a00%3a00%2b00%3a00&$top=1
I got a response with empty value field along with some nextlink. when I again called the API with Nextlink URL response was having blank value field.
{
"value": [],
"nextLink": somelink
}
I am able to get proper response using same API for some different subscription.
Empty Array shows that it doesn;t have any usage details available for requested time frame.
Firstly as suggested by Tony, check if you have the usage resource for the requested date.
**Important**
Please note that the dateTime value format must be URL encoded as ISO 8601 format, and non-numeric characters must use escape codes (i.e. colon is escaped to %3a, plus sign is escaped to %2b) so that it is URI friendly. These refer to the start and end time ranges of your query. This dateTime parameter must also be specified in Universal Time Coordinated (UTC).
Secondly , Set {aggregationGranularity} to ‘Hourly’. This is an optional parameter with two discrete potential values: Daily and Hourly. As the values suggest, the former one returns the data in daily granularity whereas the latter one is hourly resolution. Daily is the default.
Sample URI:
**https://management.azure.com/subscriptions/{subscription-Id}/providers/Microsoft.Commerce/UsageAggregates?api-version=2015-06-01-preview\&reportedStartTime=2014-05-01T00%3a00%3a00%2b00%3a00\&reportedEndTime=2015-06-01T00%3a00%3a00%2b00%3a00\&aggregationGranularity=Hourly\&showDetails=f**
Hope it helps.
Make sure that you have enough permissions for the subscription in question.
Empty result [] can be returned when the permissions are missing. There is no error shown in such case.
The easiest way to ensure the permissions are available is to use Contributor or Owner role.
Additionally, Get-UsageAggregates -Debug (from Az PowerShell module) can be used to check how the request URL should look like.
Get-UsageAggregates -ReportedStartTime "2022-05-24 10:00" -ReportedEndTime "2022-05-24 15:00" -Debug -AggregationGranularity Hourly
Related
I am trying to retrieve a csv file from the Azure blob storage using the logic apps.
I set the azure storage explorer path in the parameters and in the get blob content action I am using that parameter.
In the Parameters I have set the value as:
concat('Directory1/','Year=',string(int(substring(utcNow(),0,4))),'/Month=',string(int(substring(utcnow(),5,2))),'/Day=',string(int(substring(utcnow(),8,2))),'/myfile.csv')
So during the run time this path should form as:
Directory1/Year=2019/Month=12/Day=30/myfile.csv
but during the execution action is getting failed with the following error message
{
"status": 400,
"message": "The specifed resource name contains invalid characters.\r\nclientRequestId: 1e2791be-8efd-413d-831e-7e2cd89278ba",
"error": {
"message": "The specifed resource name contains invalid characters."
},
"source": "azureblob-we.azconn-we-01.p.azurewebsites.net"
}
So my question is: How to write path to get data from the time series partitioned path.
The response of the Joy Wang was partially correct.
The Parameters in logic apps will treat values as a String only and will not be able to identify any functions such as concat().
The correct way to use the concat function is to use the expressions.
And my solution to the problem is:
concat('container1/','Directory1/','Year=',string(int(substring(utcNow(),0,4))),'/Month=',string(int(substring(utcnow(),5,2))),'/Day=',string(int(substring(utcnow(),8,2))),'/myfile.csv')
You should not use that in the parameters, when you use this line concat('Directory1/','Year=',string(int(substring(utcNow(),0,4))),'/Month=',string(int(substring(utcnow(),5,2))),'/Day=',string(int(substring(utcnow(),8,2))),'/myfile.csv') in the parameters, its type is String, it will be recognized as String by logic app, then the function will not take effect.
And you need to include the container name in the concat(), also, no need to use string(int()), because utcNow() and substring() both return the String.
To fix the issue, use the line below directly in the Blob option, my container name is container1.
concat('container1/','Directory1/','Year=',substring(utcNow(),0,4),'/Month=',substring(utcnow(),5,2),'/Day=',substring(utcnow(),8,2),'/myfile.csv')
Update:
As mentioned in #Stark's answer, if you want to drop the leading 0 from the left.
You can convert it from string to int, then convert it back to string.
concat('container1/','Directory1/','Year=',string(int(substring(utcNow(),0,4))),'/Month=',string(int(substring(utcnow(),5,2))),'/Day=',string(int(substring(utcnow(),8,2))),'/myfile.csv')
I am trying to fetch the RateCards for my Azure subscription, however I am unable to figure out the correct (combination of) parameters for my call to the API. I keep getting the following message:
{
"Message": "Invalid query specified. Please specify valid values for OfferDurableId, Currency, Locale and RegionInfo."
}
I'm currently supplying the following parameters:
$filter=OfferDurableId eq ’MS-AZR-0003P’ and Currency eq ’EUR’ and Locale eq ’en-US’ and RegionInfo eq ’NL’
I'm not certain whether there are any requirements between the OfferDurableId, Currency and Locale parameters, but I think these are fine. The parameter I'm mostly confused about is RegionInfo. As per the documentation (whatever little there is), this is the 2-letter ISO code which represents the country in which I purchased my subscription. I am quite certain that this was bought in the Netherlands, hence my attempt with NL, but it doesn't work. I've tried IE, GB, US and some neighbouring countries, but none of them work.
I should mention, the example in the docs (MS-AZR-0003P, USD, en-US and US) doesn't work for my subscription either, I'm guessing due to a mismatch in RegionInfo.
What would be a correct combination of values? Where would I find these values? (e.g. where would I find RegionInfo?)
As per #GauravMantri's response, the issue was indeed in the quotes. The "weird backquotes" (which were copied straight from Microsoft's documentation itself) are the issue. When replaced with normal single quotes (and after url-encoding the $filter value), the query works and returns my rate cards.
In Azure API Management, I need to check whether or not a query parameter is set. To achieve this, I'm trying to use context.Request.Url.Query.GetValueOrDefault(queryParameterName: string, defaultValue: string).
According to the documentation, this expression works as follows -
Returns comma separated query parameter values or defaultValue if the parameter is not found.
With that in mind, I used the example from the MS blog Policy Expressions in Azure API Management, to create the following <inbound> policy -
<set-variable name="uniqueId" value="#(context.Request.Url.Query.GetValueOrDefault("uniqueId", ""))" />
However, whenever I include this policy, execution fails with 404 Resource Not Found. Upon inspection of the trace, I can see that the execution was aborted without error before a single policy was evaluated (no matter where within <inbound> the above policy is placed.
This behavour results in the following <backend> trace, which explains the 404
"backend": [
{
"source": "configuration",
"timestamp": "2017-09-07T12:42:13.8974772Z",
"elapsed": "00:00:00.0003536",
"data": {
"message": "Unable to identify Api or Operation for this request. Responding to the caller with 404 Resource Not Found."
}
}
],
Given that the MS documentation seems to be inaccurate, how can I check whether or not a query parameter is set?
So the answer here is that there is (another) MS bug.
When the API operation was originally created, the uniqueId query parameter was set as required. I changed this so that it was not required before adding the policy described in my question, however a bug within the new Azure Portal means that when you uncheck the Required box adjacent to the query parameter and then save your changes, they are ignored.
I was able to work around this behaviour be editng the YAML template in the OpenAPPI specification view, removing the declaration required: true for the query parameter in question. The expresion within my policy now works as expected.
Please note: that this workaround sheds light on yet another bug, where saving the template results in your policies being deleted, so make sure you take a copy first.
Hi Guys I am building a Client which Interact with Azure Storage Rest API.
I was going through documentation https://learn.microsoft.com/ru-ru/rest/api/storageservices/fileservices/list-containers2:
And didn't understood the use of parameter prefix and marker which can be send along with Azure request.
It says:
prefix
Optional. Filters the results to return only containers whose name
begins with the specified prefix.
marker
Optional. A string value that identifies the portion of the list of
containers to be returned with the next listing operation. The
operation returns the NextMarker value within the response body if the
listing operation did not return all containers remaining to be listed
with the current page. The NextMarker value can be used as the value
for the marker parameter in a subsequent call to request the next page
of list items.
The marker value is opaque to the client.
With Prefix, I think:
If i have dir structure:
file01.txt
images/image01.jpg
images/folder/image001.jpg
fightVideo/subFolder/current/video001.mpg
fightVideo/subFolder/current/video002.mpg
If I give prefix container name as "fight". It should return
fightVideo.
But I am not sure.
And for Marker I don't understand whats its use?
Please can someone explain the use of Prefix and Marker with examples?
In context of listing containers, if you specify prefix parameter it will list the containers names of which start with that prefix value. It has nothing to do with listing blobs.
List blobs operation also supports this prefix parameter and when you specify this parameter, it will list the blobs names of which start with that prefix value.
So the example you have given is for listing blobs and when you specify flight as prefix there, you will get back fightVideo/subFolder/current/video001.mpg and fightVideo/subFolder/current/video002.mpg in response but not when you call list containers with this prefix.
Regarding marker, Kalyan's explanation is correct but let me add a little bit more to that.
Essentially Azure Storage Service is a shared service and you simply can't ask it to return all the results in one go (if we were to take an analogy from SQL world, you simply can't do SELECT * FROM TABLE kind of thing). Each request to the service is assigned a predefined timeout and the response would include the items fetched in that time + optionally a token if the service thinks that there's more data available. This token is called continuation token. In order to get the next set of items, you would need to pass this continuation token in the marker parameter in your next request.
Each call to storage service will try to return a predefined maximum number of items. For listing blob containers/blobs, this limit is 5000 items. For listing tables/entities, this limit is 1000 items. If there are more items in your account, then apart from this data storage service returns you a continuation token which tells you that there's more data available.
Please note that even though the limit is there but you can't always assume that you will get these number of records. Based on a number of conditions, it is quite possible that you don't get back any data but still receive a continuation token. So your code need to handle this condition as well.
If there are too many blobs to be listed, then the response contains the NextMarker element.
<?xml version="1.0" encoding="utf-8"?>
<EnumerationResults ServiceEndpoint="https://myaccount.blob.core.windows.net">
<Prefix>string-value</Prefix>
<Marker>string-value</Marker>
<MaxResults>int-value</MaxResults>
<Containers>
<Container>
<Name>container-name</Name>
<Properties>
<Last-Modified>date/time-value</Last-Modified>
<Etag>etag</Etag>
<LeaseStatus>locked | unlocked</LeaseStatus>
<LeaseState>available | leased | expired | breaking | broken</LeaseState>
<LeaseDuration>infinite | fixed</LeaseDuration>
<PublicAccess>container | blob</PublicAccess>
</Properties>
<Metadata>
<metadata-name>value</metadata-name>
</Metadata>
</Container>
</Containers>
<NextMarker>marker-value</NextMarker>
</EnumerationResults>
The REST API documentation mentions that the marker value can be used in a subsequent call to request the next set of list items.
You can imagine marker as a paginatator index.
I have this function to correlate icx_ticket in a LoadRunner script:
web_reg_save_param("WCSParam11",
"LB=icx_ticket='",
"RB/IC='resp",
"Ord=1",
"Search=Body",
LAST);
The parameter is not being captured and I am consistently getting this error.
Action.c(127): Error -26377: No match found for the requested parameter "WCSParam11". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 10240 bytes, use web_set_max_html_param_len to increase the parameter size [MsgId: MERR-26377]
Action.c(127): Notify: Saving Parameter "WCSParam11 = ".
I can see in the data returned by the server icx_ticket appears as:
Action.c(79): GET /OA_HTML/txkObjectTag.js HTTP/1.1\r\n
Action.c(79): Referer: http://erpuat.safaricom.net:8010/forms/frmservlet?appletmode=nonforms&HTMLpageTit
Action.c(79): le=&HTMLpreApplet=&code=oracle/apps/fnd/formsClient/FormsLauncher.class&width=400&height=3
Action.c(79): 00&archive=/OA_JAVA/oracle/apps/fnd/jar/fndforms.jar,/OA_JAVA/oracle/apps/fnd/jar/fndforms
Action.c(79): i18n.jar,/OA_JAVA/oracle/apps/fnd/jar/fndewt.jar,/OA_JAVA/oracle/apps/fnd/jar/fndswing.jar
Action.c(79): ,/OA_JAVA/oracle/apps/fnd/jar/fndbalishare.jar,/OA_JAVA/oracle/apps/fnd/jar/fndaol.jar,/OA
Action.c(79): _JAVA/oracle/apps/fnd/jar/fndctx.jar,/OA_JAVA/oracle/apps/fnd/jar/fndlist.jar&jinit_applet
Action.c(79): cache=off&gp15=icx_ticket&gv15=Vg4ifaWvXEHX1nnuRaKLlg..&gp2=resp_app&gv2=SQLGL&gp3=resp&gv
Action.c(79): 3=GENERAL_LEDGER_SUPER_USER&gp4=sec_group&gv4=STANDARD&gp5=function&gv5=GLXJEPST&gp6=other
Action.c(79): _params&gv6=&gp7=jsp_agent&gv7=http%3A%2F%2Ferpuat.safaricom.net%3A8010%2FOA_HTML%2F&gp13=
Action.c(79): dbc&gv13=ERPUAT\r\n
Kindly assist me to correctly capture and save the icx_ticket parameter.
As from my experience you will not able to correlate any value in ORACLE.
For saving the dynamic value which comes from server you can use
nca_edit_get_text("Field_Name",Variable_Name);
Here Field name is the name of the field where this value is present/display and varable mane is the variable you create for storing the data.
lr_save_string(Variable_Name, "Any_Name");
After that you can save your variable into load-runner variable using above function.
As from my experience you will not able to correlate any value in ORACLE.
You have very limited experience then.
If a Value is returned then it can be captured. Here we have the example of an autocorrelated variable not being captured. One must first ask if the recommended autocorrelation left boundary and right boundary conditions are optimal? If not, then tune them to be more robust - this requires that the user have manual correlation skills to address the issue No manual correlation skills then "No joy" on a solution.
Next, let's look at process items that are very commonly paired with a failing autocorrelation, does the script include active examination of expected results from each and every request and then does the script branch execution when the expected result fails to appear. There is a very high statistical correlation between no check on expected results and a failed LoadRunner variable autocorrelation, on the order of greater than 95%.