|
3 | 3 |
|
4 | 4 | # The following is intended for developers of fabric-cicd to debug and call Fabric REST APIs locally from the github repo |
5 | 5 |
|
6 | | -from azure.identity import ClientSecretCredential, DefaultAzureCredential |
| 6 | +from azure.identity import AzureCliCredential, AzurePowerShellCredential, ClientSecretCredential |
7 | 7 |
|
8 | 8 | from fabric_cicd import change_log_level, constants |
9 | 9 | from fabric_cicd._common._fabric_endpoint import FabricEndpoint |
|
13 | 13 | # change_log_level() |
14 | 14 |
|
15 | 15 | if __name__ == "__main__": |
16 | | - # Replace None correct value when using SPN auth |
| 16 | + # Azure CLI auth - comment out to use a different auth method |
| 17 | + token_credential = AzureCliCredential() |
| 18 | + |
| 19 | + # Uncomment to use PowerShell auth |
| 20 | + # token_credential = AzurePowerShellCredential() |
| 21 | + |
| 22 | + # Uncomment to use SPN auth |
17 | 23 | # client_id = "your-client-id" |
18 | 24 | # client_secret = "your-client-secret" |
19 | 25 | # tenant_id = "your-tenant-id" |
20 | | - token_credential = ( |
21 | | - None # ClientSecretCredential(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id) |
22 | | - ) |
| 26 | + # token_credential = ClientSecretCredential(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id) |
23 | 27 |
|
24 | 28 | # Create endpoint object |
25 | | - fe = FabricEndpoint( # if credential is not defined, use DefaultAzureCredential |
26 | | - token_credential=( |
27 | | - DefaultAzureCredential() if token_credential is None else validate_token_credential(token_credential) |
28 | | - ) |
29 | | - ) |
| 29 | + fe = FabricEndpoint(token_credential=validate_token_credential(token_credential)) |
| 30 | + |
30 | 31 | # Set workspace id variable if needed in API url |
31 | 32 | workspace_id = "8f5c0cec-a8ea-48cd-9da4-871dc2642f4c" |
32 | 33 |
|
|
0 commit comments