You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constructs a URI by combining the provided scheme, host, path, query, and fragment components into a single URI string. To parse a URI, see [parseUri](#parseuri).
| query | No | string | The query string, including the leading `?` if present (e.g., `?key=value`). Defaults to an empty string if not provided. |
158
+
| fragment | No | string | The fragment identifier, including the leading `#` if present (e.g., `#section`). Defaults to an empty string if not provided. |
159
+
160
+
* The `scheme`, `host`, and `path` parameters are required to ensure a valid URI structure.
161
+
* The `query` and `fragment` parameters are optional and can be omitted or set to an empty string (`''`) if not needed.
162
+
* The function handles proper formatting, ensuring correct separators (e.g., `://` between scheme and host, `/` for paths, `?` for queries, `#` for fragments) and avoids issues like double slashes.
163
+
* For complete details, the URI is constructed as specified in [RFC 3986, section 3](https://tools.ietf.org/html/rfc3986#section-3).
164
+
165
+
### Return Value
166
+
167
+
A string representing the absolute URI constructed from the provided components.
168
+
169
+
### Examples
170
+
171
+
The following example shows how to use `buildUri` to construct a URI from individual components:
172
+
173
+
```bicep
174
+
var scheme = 'https'
175
+
var host = 'mystorage.blob.core.windows.net'
176
+
var path = '/templates/nestedTemplate.json'
177
+
var query = '?st=2025-05-09'
178
+
var fragment = '#section'
179
+
180
+
var constructedUri = buildUri(scheme, host, path, query, fragment)
The following example shows how to use `parseUri` to extract components from an existing URI, modify them, and then use `buildUri` to reconstruct a new URI:
var newUri = buildUri(parsedUri.scheme, parsedUri.host, newPath, newQuery, parsedUri.fragment)
223
+
224
+
output originalHost string = parsedUri.host
225
+
output newUri string = newUri
226
+
```
227
+
142
228
## concat
143
229
144
230
`concat(arg1, arg2, arg3, ...)`
@@ -894,6 +980,87 @@ The output from the preceding example with the default values is:
894
980
| ---- | ---- | ----- |
895
981
| stringOutput | String | 0000000123 |
896
982
983
+
## parseUri
984
+
985
+
`parseUri(uriString)`
986
+
987
+
Parses a URI string into its constituent components, such as scheme, host, path, query, and fragment. To build a URI string, see [buildUri](#builduri).
The following example shows how to use `parseUri` to extract the host and scheme, then reconstruct a new URI with a different path using the `uri` function:
0 commit comments