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
- Changed integration tests to deploy Cosmos DB using Bicep.
21
+
- Update `requirements.psd1` to install modules `Az.Accounts` 2.19.0 and `Az.Resources` 6.16.2.
22
+
- Renamed `New-CosmosDbAuthorizationToken` to `New-CosmosDbAuthorizationHeader` to better indicate
23
+
actual function return type.
24
+
- Refactored `Invoke-CosmosDbRequest` to support getting the EntraIdToken property from the context object
25
+
and using it for authentication if it is provided. If the Key property is provided, the EntraIdToken property
26
+
will take precendence and the key will be ignored.
27
+
- Updated CI pipeline to use `PublishCodeCoverageResults@2` task rather than `PublishCodeCoverageResults@1`
28
+
task to support the latest version of the task.
29
+
30
+
### Changed
31
+
32
+
- BREAKING CHANGE: Updated module to require `Az.Accounts` v2.19.0 or newer and `Az.Resources`
33
+
v6.16.2 or newer.
34
+
- Renamed `New-CosmosDbAuthorizationHeader` to `Get-CosmosDbAuthorizationHeaderFromContext` to better indicate
35
+
actual function behaviour.
36
+
- Renamed `Get-CosmosDbAuthorizationHeadersFromContext` to `Get-CosmosDbAuthorizationHeaderFromContextResourceToken` to better
37
+
indicate actual function behaviour and align naming convention.
38
+
- Refactored `Invoke-CosmosDbRequest` to clean up logic to generate the authorization header.
39
+
- Added new utillity function `Get-CosmosDbAuthorizationHeaderFromContextEntraId` to generate the authorization
40
+
header when an Entra ID Token is provided in the context. This function is used by `Invoke-CosmosDbRequest` to
41
+
generate the authorization header when an Entra ID Token is provided.
42
+
43
+
### Added
44
+
45
+
- Added support for setting an Entra Id OAuth2 Token in the `New-CosmosDbContext` - Fixes [Issue #479](https://github.com/PlagueHO/CosmosDB/issues/479).
46
+
- Added new `Get-CosmosDbEntraIdToken` function that uses `Get-AzAccessToken` to get an Entra Id Token
47
+
for use in Cosmos DB requests. This is used by `New-CosmosDbContext` to set the Entra Id Token in the
> Important: Using an Entra ID Authorization Token is only supported by setting it
178
+
> in a CosmosDB.Context object and passing that to the commands you want to execute.
179
+
> Not all commands support this method of authentication. If you need to use a command
180
+
> that doesn't support this method of authentication, you will need to use one of the
181
+
> other methods of authentication. See the [Database Operations allowed by Role-Based Access Control](#database-operations-allowed-by-role-based-access-control)
182
+
> section for more information.
183
+
184
+
##### Configuring Role-Based Access Control (RBAC) with Entra ID
185
+
186
+
There are several ways to configure a Cosmos DB Account with Role-Based Access Control,
187
+
including:
188
+
189
+
-*Azure Bicep*: An example can be found in the [\tests\TestHelper\AzureDeploy\CosmosDb.bicep](\tests\TestHelper\AzureDeploy\CosmosDb.bicep) file.
190
+
-*Azure PowerShell*: The integration tests use this method.
191
+
-*AzCli*.
192
+
193
+
> Important Note: One thing I found when adding a SQL Role Assignment to the Cosmos DB
194
+
> Account (or Database or Container) is that the principal ID must be the Object ID of
195
+
> the user, group or service principal that you want to assign the role to. You can't use
196
+
> the Application ID for this value.
197
+
198
+
For more information on how to configure Role-Based Access Control with Entra ID, see the
199
+
[Configure role-based access control with Microsoft Entra ID for your Azure Cosmos DB account](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-setup-rbac)
200
+
page.
201
+
202
+
##### Database Operations allowed by Role-Based Access Control
203
+
204
+
Only a subset of all the operations that can be performed on a Cosmos DB account are
205
+
allowed by Role-Based Access Control. The following operations are allowed:
206
+
This permission model covers only database operations that involve reading and writing data. It does not cover any kind of management operations on management resources, including:
207
+
208
+
- Create/Replace/Delete Database
209
+
- Create/Replace/Delete Container
210
+
- Read/Replace Container Throughput
211
+
- Create/Replace/Delete/Read Stored Procedures
212
+
- Create/Replace/Delete/Read Triggers
213
+
- Create/Replace/Delete/Read User Defined Functions
214
+
215
+
For more information on this, please see the [Role-based access control (RBAC) with Azure Cosmos DB](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-setup-rbac#permission-model) page.
216
+
132
217
#### Create a Context specifying the Key Manually
133
218
219
+
> Note: This method of authenticating to Cosmos DB is not recommended for
220
+
> production use. It is recommended to use the _Entra ID Authorization Token_
0 commit comments